Canonical urls causing facebook posts to all link to default site

If any of my users post one of their landing pages to facebook, facebook grabs the canonical url which all link back to the default site for EVERY site that posts a link to FB

So if they post a link and it doesn' t matter what the "subsite" is such as:
http://evantage360.com/subsite/affiliates/

Facebook always links to the same page because of this canonical link in the head.
<link rel="canonical" target="_blank" href="http://evantage360.com/default-template/affiliates/" />

The fetched url & the canonical url don't match. I am not using a seo plugin.
Any tips on how to correct my canonical urls how I ended up point them all to my default site?

thanks!!

  • Vinod Dalvi
    • WP Unicorn

    Hi @George,

    I hope you are well today and thank you for your question.

    Facebook always links to the same page because of this canonical link in the head.
    <link rel="canonical" href="http://evantage360.com/default-template/affiliates/" />

    I don't find this canonical URL on your site evantage360 also the subsite URL http://evantage360.com/subsite/affiliates/ is not working.

    Could you please share me the actual working site URLs so that i can test it?

    You can change the canonical URL by using our following Infinite SEO plugin as displayed in the attached screenshot.

    https://premium.wpmudev.org/project/wpmu-dev-seo/#product-usage

    You can find more information about canonicalization for WordPress on the following page.

    https://premium.wpmudev.org/blog/wordpress-canonicalization-guide/

    Best Regards,
    Vinod Dalvi

  • George
    • The Bug Hunter

    I have an update on this.
    I needed to get this working quickly & tried your seo plugin and tried using the function to remove the canonical url from the head but couldn't get it to work.
    Since I already have too many plugins what I did was use this function I found:
    `//Adding the Open Graph in the Language Attributes
    function add_opengraph_doctype( $output ) {
    return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
    }
    add_filter('language_attributes', 'add_opengraph_doctype');
    //Lets add Open Graph Meta Info
    function insert_fb_in_head() {
    global $post;
    if ( !is_singular()) //if it is not a post or a page
    return;
    echo '<meta property="fb:admins" content="user_id_here"/>';
    echo '<meta property="og:title" content="' . get_the_title() . '"/>';
    echo '<meta property="og:type" content="article"/>';
    echo '<meta property="og:url" content="' . get_permalink() . '"/>';
    echo '<meta property="og:site_name" content="Evantage 360"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    $default_image="http://evantage360.com/images/logo-160.png"; //replace this with a default image on your server or an image in your media library
    echo '<meta property="og:image" content="' . $default_image . '"/>';
    }
    else{
    $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
    }
    echo "
    ";
    }
    add_action( 'wp_head', 'insert_fb_in_head', 5 );`

    The facebook debugger still shows an error:
    Object at URL 'http://evantage360.com/bmorken/1-click-insurance-ad/' of type 'article' is invalid because the given value '310741115792668' for property 'fb:admins' could not be parsed as type 'fbid'.

    But at least my facebook links will now work while I try to figure out a better solution.

    thanks!

  • Vinod Dalvi
    • WP Unicorn

    Hi @George,

    Thank you for your reply.

    To resolve the error message could you please just try removing the following code from your share code?

    echo '<meta property="fb:admins" content="user_id_here"/>';

    It seems you are using wrong admin id in the above code. Find more information about it on the following pages.

    https://developers.facebook.com/docs/platforminsights/domains
    http://stackoverflow.com/a/6417679/1287548
    http://stackoverflow.com/a/10836476/1287548

    Regards,
    Vinod Dalvi

  • George
    • The Bug Hunter

    Thanks so much for your help. I was in hurry to repair this but found the problem and it was in one of my other plugins. There was and seo setting in one of my plugins
    Child posts have their canonical URLs pointed to the URL of the parent post. This automatically disables the canonical URL from Yoast's Wordpress SEO plugin.
    I didn't know what that was for ( I do now) and had that checked and it was causing the issue.

    Hope I didn't waste too much of your time, thanks again!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.