# Hide the Yoast Box on Selected Post Types

> Removes the Yoast SEO meta box from post types that never appear in search, such as internal records, while leaving it on everything else.

- Type: PHP
- Runs: Admin only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: yoast, admin, custom-post-types
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/yoast-hide-metabox-post-types/

## Code

```php
// Post types without the Yoast box.
$wpide_yoast_hidden_types = array( 'testimonial', 'faq' );

add_action( 'add_meta_boxes', function ( $post_type ) use ( $wpide_yoast_hidden_types ) {
    if ( in_array( $post_type, $wpide_yoast_hidden_types, true ) ) {
        remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
    }
}, 100 );
```

## Notes

To exclude a post type from Yoast entirely, also set it to "noindex" in Yoast's settings.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the Yoast Box on Selected Post Types" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
