How to prevent yoast from stripping off ?get variables
-
I have a wordpress site where a custom template processes urls like
https://mysite.com/program/?id=424
Yoast broke this functionality a few years ago, so I implemented the hack below to our functions.php file.
However, one of the more recent updates breaks our work-around.
How do I keep yoast from messing around with our ?get variables?
/* YOAST SEO MODIFICATIONS */ if (function_exists('is_plugin_active') && is_plugin_active('wordpress-seo/wp-seo.php')) { // remove YOAST processing on the generic /program/?id=xxx page add_action('template_redirect','remove_wpseo'); function remove_wpseo(){ if ( is_page(35409)) { $wp_thing = WPSEO_Frontend::get_instance(); remove_action('wp_head',array($wp_thing,'head'),1); } } // do not let YOAST remove ?variables for our program pages add_filter( 'wpseo_opengraph_url', 'filter_wpseo_opengraph_url', 10, 1 ); function filter_wpseo_opengraph_url( $wpseo_frontend ) { if (stristr($wpseo_frontend, '/program/')) { $wpseo_frontend = "https://www.upaya.org" . $_SERVER[REQUEST_URI]; } return $wpseo_frontend; }; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to prevent yoast from stripping off ?get variables’ is closed to new replies.