Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
You can use the hooks you can find here: https://rankmath.com/kb/filters-hooks-api-developer/#breadcrumbs to remove every meta data and OG tag Rank Math adds in a custom post type.
For example, let’s say you have a custom post type called “MyCustomPostType”. To remove all the OG tags on posts of that type, you can use this filter:
/**
* Hook to remove og:tags
*/
add_action( 'rank_math/head', function() {
if(is_singular('MyCustomPostType'){
remove_all_actions( 'rank_math/opengraph/facebook' );
remove_all_actions( 'rank_math/opengraph/twitter' );
}
});
This one would be to remove the Rank Math Json+Ld Data:
/**
* Code to remove json+ld data
*
*/
add_action( 'rank_math/head', function() {
if(is_singular('MyCustomPostType'){
global $wp_filter;
if ( isset( $wp_filter["rank_math/json_ld"] ) ) {
unset( $wp_filter["rank_math/json_ld"] );
}
}
});
`
Looking forward to helping you. Thank you.
I know about these filters but i just want to completely disable title / meta descriptions – everything from rank math on my custom post type front-end page.
Also you mentioned a filter to change any social og tag but below not working.
add_filter( "rank_math/opengraph/facebook/image:width", function( $content ) {
$content = '600';
return $content;
});
Hi Satinder,
I am afraid we do not have a custom filter for doing that.
Sorry.
I managed to do this, you already have a filter to change custom og:width 🙂
here is correct one:-
add_filter( "rank_math/opengraph/facebook/og_image_width", function( $content ) {
$content = '600';
return $content;
});
Hi,
You had mentioned you wanted the title/description removed on a particular post.
I am glad it is working fine for you.
Please do not hesitate to let us know if you need our assistance with anything else.