⏲️ Estimated reading time: 3 min
How To Disable Yoast SEO Output in WordPress. If you need to disable Yoast SEO’s output on specific posts, pages, or custom post types, you can achieve this by adding a simple code snippet to your theme’s functions.php file. This guide will show you how to remove Yoast SEO output based on different conditions.
Disable Globally or for Specific Posts
To disable Yoast SEO output on the homepage, front page, or for specific posts, add the following code to your functions.php file:
<?php
/**
* Disable Yoast SEO output
*/
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_home() || is_front_page() ){
$front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class );
remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 );
}
if (is_single()) {
$front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class );
remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 );
}
}

Explanation:
- The code hooks into
template_redirectto remove the Yoast SEO meta output. is_home()andis_front_page()conditions ensure that Yoast SEO is disabled for the homepage and front page.is_single()ensures that Yoast SEO is removed for all single post pages.
Disable Yoast SEO for a Specific Page
To apply this to a specific page, use is_page:
if ( is_page ( 1 ) ) { //... }
Disable Yoast SEO for Multiple Posts or Pages
To disable the output for multiple posts or pages, pass an array of post IDs:
if ( is_single( [ 123456, 234567, 345678 ] ) ) { //... }
or for pages:
if ( is_page( [ 123456, 234567, 345678 ] ) ) { //... }
Disable Yoast SEO for a Custom Post Type
If you want to remove output for an entire custom post type, use is_singular:
if ( is_singular( 'my_custom_posttype' ) ) { //... }
This method ensures that Yoast SEO’s metadata is removed from all posts under the specified custom post type.
Final Notes
- Always back up your
functions.phpfile before making modifications. - If your website is running a child theme, add the code to the child theme’s
functions.phpfile instead. - Test changes in a staging environment before deploying them live.
By using these methods, you can control where Yoast SEO outputs metadata, improving flexibility in your WordPress setup.
Tags: WordPress, Yoast SEO, SEO Optimization, Remove Yoast Metadata, WordPress Functions, WordPress SEO, Disable Yoast, Custom Post Types, Functions.php, WordPress Development