WordPress.org

Forums

Facebook
[resolved] More Than One OG URL Specified (9 posts)

  1. fouldsy99
    Member
    Posted 1 year ago #

    Hi,

    This has been bugging me for ages, I've been trying everything to work:

    Facebook debug tool works perfect on my site, right until I activate Facebook plugin, I've tried this with every plugin I have de-activated apart from Facebook one.

    It says on facebook debug page when Facebook plugin is activated: More Than One OG URL Specified - Object at URL 'http://worldinsport.com' of type 'website' is invalid because it specifies multiple 'og:url' values: http://worldinsport.com, http://worldinsport.com.

    How can I fix this please?

    http://wordpress.org/plugins/facebook/

  2. fouldsy99
    Member
    Posted 1 year ago #

    Here is the code I'm using on header.php

    Does it look correct?

    <?php
        if(is_single() || is_page())
            {
            echo '
                      <meta property="og:title" content="'.get_bloginfo('name').' :
     '.single_post_title('', false).'" />
                      ';
            while(have_posts()):the_post();
                  $og_thumb_meta = get_post_meta($post->ID,'_thumbnail_id',false);
                  $og_img = wp_get_attachment_image_src($og_thumb_meta[0], false);
                  $og_thumb = $og_img[0];
                $og_excerpt = str_replace(array("\r\n", "\r", "\n"), "", get_the_excerpt());
                $og_excerpt_clean = apply_filters('the_excerpt_rss', $og_excerpt);
            endwhile;
            echo '<meta property="og:description" content="'.strip_tags($og_excerpt_clean).'" />';
            }
            else{
            echo '
                <meta property="og:title" content="'.get_bloginfo('name').'" />
                  <meta property="og:description" content="'.get_bloginfo('description').'" />
                ';
            }
        if(is_home() || is_front_page())
            {
             echo '
                 <meta property="og:type" content="website" />
                   <meta property="og:url" content="'.get_bloginfo('url').'"/>
                ';
            }
            else{
             echo '
                 <meta property="og:type" content="article" />
                 <meta property="og:url" content="'.get_permalink().'"/>
                 ';
            }
          if(!isset($og_thumb) || $og_thumb == null)
             {
            $og_thumb = get_bloginfo('stylesheet_directory').'/wis.jpg';
            }
        echo '
            <meta property="og:image" content="'.$og_thumb.'" />
            <meta property="fb:admins" content=""/>
            ';
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code (not the blockquote) button. Your posted code may now have been permanently damaged by the forum's parser.]

  3. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year ago #

    The Facebook plugin for WordPress adds Open Graph protocol markup to your webpages. If you prefer to define your own Open Graph protocol markup you should unhook Facebook_Open_Graph_Protocol:: add_og_protocol from the wp_head action.

  4. fouldsy99
    Member
    Posted 1 year ago #

    Hi Niall,

    I'm not quite sure how to follow what you said, could you be more specific please?

    Regards

  5. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year ago #

    If another piece of your WordPress system outputs an og:url value then remove all other pieces trying to output an og:url value until you are left with a single og:url value.

    If you want to remove the Open Graph protocol content output by the Facebook plugin for WordPress you should unhook the Facebook_Open_Graph_Protocol::add_og_protocol function from the wp_head WordPress action.

  6. fouldsy99
    Member
    Posted 1 year ago #

    I've found og:url markups in few pages associated with Jetpack, does this cause problems?

    I've not noticed og:url in any other pages apart from Facebook plugin and Jetpack.

    Regards

  7. fouldsy99
    Member
    Posted 1 year ago #

    ok, a little progress.

    I've managed to remove other outputs an og:url

    When I run the fb debug on http://www.worldinsport.com the results are perfect.

    But when I run the debug tool on a article page like: worldinsport.com/jack-dempsey-the-manassa-mauler/ the debug tool says:

    Your page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree.
    Please fix this in order for the tags to be usable.

    And also says: The parser's result for this metadata did not match the input metadata. Likely, this was caused by the data being ordered in an unexpected way, multiple values being given for a property only expecting a single value, or property values for a given property being mismatched.

    Here are the input properties that were not seen in the parsed result: 'og:description'

    How can I fix this?

    Many thanks

  8. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year ago #

    The Facebook plugin for WordPress outputs Open Graph protocol properties as part of the wp_head action. Typically themes include the output of the wp_head action somewhere in between <head> and </head> in the theme's HTML.

    If you are supplying your own Open Graph protocol make sure it appears between <head> and </head>. Your document should only have one <head> element.

  9. fouldsy99
    Member
    Posted 1 year ago #

    Ok cleared a few things up.

    All I'm getting now on single page is: Provided og:image is not big enough. Please use an image that's at least 200x200 px. Image 'xxx' will be used instead.

    top level domain works fine on the debugger.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Facebook
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.