Code-Snippets-Functions/Execute a function on a child site/Yoast SEO/disabling-yoast-seo.txt

12 lines
403 B
Text

add_action( 'template_redirect', 'remove_wpseo' );
/**
* Removes output from Yoast SEO on the frontend for a specific post, page or custom post type.
*/
function remove_wpseo() {
if ( is_single ( 1 ) ) {
$front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class );
remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 );
}
}