-
Hi,
I am using Rank Math plugin and want to remove the canonical URL for single post with post ID 1234.
I’ve got this filter that removes canonical url from ALL posts. I need to modify it for single post or few posts with post ID. Note: I’m also using Code Snippets plugin to insert php function.add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
return false;
});
what I want to do is (for example)
function rankmath_canonical_url( $canonical_url, $post ) {
if ( $post->ID === 1234 ) {
// remove canonical url on post id 1234
...
Can you please help me to write the correct filter for removal of canonical url on single post and multiple posts (but not all posts).
You must be logged in to reply to this ticket.