-
Hi Team,
I’m using Rank Math plugin and it turns to be best and light-weight!
I’ve to remove canonical tag from certain post IDs ONLY.I found few posts on WordPress support and Rank Math site but they were related to removing canonical URLs from entire site or category/tag. So I could not find the right solution.
I tried to use custom function like:
if( is_single( array( 3861, 4006, 4027, 4010 ) ) ) { return false;and this too:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) { // Disable canonical $canonical = false; return $canonical; });add_filter( 'rank_math/frontend/canonical', function( $canonical ) { //target a page using its page id if(is_page('page_id')){ return false; } return $canonical; });but couldn’t combine above to get canonical URL tag removed for certain Post ids ONLY.
I mean canonical should remain active on entire site, but disable on certain posts.Could you kindly help in providing the exact function.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this ticket.