Hide Rank Math on Selected Post Types
Removes the Rank Math meta box and settings from post types that are never shown in search, such as internal records or form entries.
Opens WPIDE on
Code
// Post types Rank Math should ignore.
$wpide_rm_hidden_types = array( 'testimonial', 'faq' );
add_filter( 'rank_math/excluded_post_types', function ( $post_types ) use ( $wpide_rm_hidden_types ) {
return array_diff_key( (array) $post_types, array_flip( $wpide_rm_hidden_types ) );
} );
Notes
Use post type names; the type disappears from Rank Math's Titles & Meta settings too.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.