Yoast SEO plugin question - exclude canonical on two pages? (2 posts)

  1. roundaboutmv
    Posted 3 years ago #

    On the thread below someone gave me a great solution to exclude the canonical link that automatically appears through Yoast's SEO plugin:


    I was able to make it work for one page using this code on the plugins functions file:

    of function wpseo_canonical_exclude( $canonical ) {
    global $post;
    if ( $post->ID == xxx) {
    $canonical = false;
    return $canonical;
    add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );

    My problem is that I need to exclude the canonical on one more page, but I don't know the correct syntax. Everything I've tried so far breaks it.

  2. Tara
    Volunteer Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic