Update Broke ‘Removal’ Functionality
-
On our site, there are certain post types that create head/OG Tags Dynamically since the data is NOT coming from our post/pages — but through an external API. The following code WAS working until the update.
How do I prevent Yoast from running on certain pages and content types that are already programmed to create their own dynamic SEO descriptions, titles, etc?
add_action('template_redirect','remove_wpseo'); function remove_wpseo(){ $post = get_queried_object(); $postType = get_post_type_object(get_post_type($post)); if ($postType) { $type=esc_html($postType->labels->singular_name); } if( 'News Item' == $type ){ $wpseo_front = WPSEO_Frontend::get_instance(); if($wpseo_front){ remove_action('wp_head',array($wpseo_front,'head'),1); remove_action('wp_head', '_wp_render_title_tag', 1 ); } else { $wp_thing = WPSEO_Frontend::get_instance(); remove_action('wp_head',array($wp_thing,'head'),1); remove_action( 'wp_head', '_wp_render_title_tag', 1 ); } } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Update Broke ‘Removal’ Functionality’ is closed to new replies.