Hello,
Thank you for contacting us.
You can modify and use this filter to remove the OG tags from that specific page:
https://rankmath.com/kb/filters-hooks-api-developer/#remove-opengraph-tags
Hope this helps.
Thank you.
Thanks but where would I put that? How do I target the specific page in question?
Also is there a way to disable RankMath entirely for that same page?
Hello,
Thank you for getting in touch with us.
You can add this code into your theme’s function.php file or by creating a rank-math.php file in your active theme’s directory. We recommend adding filter/hook to rank-math.php file over functions.php file for a number of reasons.
You can follow this tutorial to add this code:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let’s say you want to exclude two page’s having page id 35 and 36 where the Rank Math’s OG:Tag function won’t work, then the code will be like this:
add_action( 'wp_head', 'rankmath_disable_features',1);
function rankmath_disable_features() {
$page_id = array('35','36');
if( is_page( $page_id) ) {
remove_all_actions( 'rank_math/opengraph/facebook' );
remove_all_actions( 'rank_math/opengraph/twitter' );
}
}
And to disable entirely Rank Math on same pages you have to use this instead of the above code:
add_action( 'wp_head', 'rankmath_disable_features',1);
function rankmath_disable_features() {
$page_id = array('35','36');
if( is_page( $page_id) ) {
remove_all_actions( 'rank_math/head');
}
}
Hope this will fix the issue. Looking forward to your update. We are here to assist you further.
Thank you.
Hello,
Adding to my colleague’s reply, here’s a screencast on how you can get the page ID: https://i.rankmath.com/VapAK0
Hope this helps.
Thank you.
Fantastic support as usual 🙂
Thank you all.
Hello,
Glad that helped.
Please feel free to reach out to us again in case you need any other assistance.
We are here to help.
Thank you.