Skip to main content
Post Closed as "Not suitable for this site" by Pieter Goosen, birgire, Johannes Pille, Nicolai Grossherr, Rarst
Notice removed Improve details by japanworm
Bounty Ended with MathSmath's answer chosen by japanworm
deleted 4514 characters in body; edited tags; edited title
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40

Meta data won't be shared properly on W3 Cache plugin and Facebook sharing

An example for a blog post that can't be shared properly: http://zoomingjapan.com/favorite-photos/yumebutai/

There are very few blog posts that work with Facebook. If I copy the URL of one of those into the Debugger I still get an error message, though:

Object Invalid Value: Object at URL 'http://zoomingjapan.com/travel/mount-koya-travel-report/' of type 'article' is invalid because the given value '377035309011137' for property 'fb:admins' could not be parsed as type 'fbid'.

The URL above is that of a blog post that could be shared properly, but yet gets an error message.Updated Information:

Thanks to Milo I finally was able to figure out that it has actually to do with my theme. When I change the theme it suddenly works! My parent theme can share properly, too: http://wordpress.site5.net/alltuts/ So, now I try to figure out WHAT in my theme is causing this error. I have no idea how to figure that out. Any ideas? :/

I replaced the header.php, footer.php, single.php and the function.php (which were the most suspicious to me) with the ones of the TwentyEleven theme of Wordpress. The problem stayed. This means it must be another theme file that is causing those issues. I keep searching for it, but I really don't know what I'm looking for :(

Here's my htaccess file: http://pastebin.com/p4dRk0Gq

I tried to replace one file after another again. Nothing. However, I noticed something else! When switching themes it works fine with TwentyEleven, but I have the exact same issue with the TwentyTen theme! Maybe that gives us a clue wherewas wrong thanks to search?? What's the big difference between those two themes? I'm really desperateMilo and refuse to believe that there is no solution for this issueMathSmath!

Here's my header.php: http://pastebin.com/EPuNLtvH

Updated Information: Ok, thanks to MathSmath we could figure out that this whole situation has something to do with theThe W3 Cache Plugin and the .htaccess entry of it. When changed I get a "200" error codeis interfering with the Debugger of Facebook along with the following error message:

Object Invalid Value: Object at URL 'http://zoomingjapan.com/travel/momoyama-castle-kyoto/' of type 'article' is invalid because the given value '377035309011137' for property 'fb:admins' could not be parsed as type 'fbid'.

After I took out the following of my function.phpsharing progress, I don't get any error messages from the Debugger anymore (only warnings):

/*******************************
FACEBOOK OPEN GRAPH 
********************************/

//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="377035309011137"/>';
        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="Zooming Japan - Your Personal Japan Guide"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
        $default_image="http://zoomingjapan.com/wp-content/themes/alltuts/images/linkback_600x156ver2.jpg"; //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 "\n";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Sharing now seems to work when I copy and paste the URL directly into Facebook but not via the Share or Like button on my blog. I'm not sure if it would help if the above code would be adjusted a bit?! Maybe I needit's quite easy to change the buttons. I'm currently using the iframe versions, I think. Furthermore, sharing doesn't work for all blog posts equally. Not sure why! http://zoomingjapan.com/travel/udo-shrine-in-miyazaki/ (this is one of the blog posts that still won't work ..)

Also, do you think there is a way Scroll down to keep using the W3 Cache plugin without causing those problems?

Please help me out heresee my answer! Thanks Works like a lot in advance for any advice you can give me.charm!

Meta data won't be shared properly on Facebook

An example for a blog post that can't be shared properly: http://zoomingjapan.com/favorite-photos/yumebutai/

There are very few blog posts that work with Facebook. If I copy the URL of one of those into the Debugger I still get an error message, though:

Object Invalid Value: Object at URL 'http://zoomingjapan.com/travel/mount-koya-travel-report/' of type 'article' is invalid because the given value '377035309011137' for property 'fb:admins' could not be parsed as type 'fbid'.

The URL above is that of a blog post that could be shared properly, but yet gets an error message.

Thanks to Milo I was able to figure out that it has actually to do with my theme. When I change the theme it suddenly works! My parent theme can share properly, too: http://wordpress.site5.net/alltuts/ So, now I try to figure out WHAT in my theme is causing this error. I have no idea how to figure that out. Any ideas? :/

I replaced the header.php, footer.php, single.php and the function.php (which were the most suspicious to me) with the ones of the TwentyEleven theme of Wordpress. The problem stayed. This means it must be another theme file that is causing those issues. I keep searching for it, but I really don't know what I'm looking for :(

Here's my htaccess file: http://pastebin.com/p4dRk0Gq

I tried to replace one file after another again. Nothing. However, I noticed something else! When switching themes it works fine with TwentyEleven, but I have the exact same issue with the TwentyTen theme! Maybe that gives us a clue where to search?? What's the big difference between those two themes? I'm really desperate and refuse to believe that there is no solution for this issue!

Here's my header.php: http://pastebin.com/EPuNLtvH

Updated Information: Ok, thanks to MathSmath we could figure out that this whole situation has something to do with the Cache Plugin and the .htaccess entry of it. When changed I get a "200" error code with the Debugger of Facebook along with the following error message:

Object Invalid Value: Object at URL 'http://zoomingjapan.com/travel/momoyama-castle-kyoto/' of type 'article' is invalid because the given value '377035309011137' for property 'fb:admins' could not be parsed as type 'fbid'.

After I took out the following of my function.php, I don't get any error messages from the Debugger anymore (only warnings):

/*******************************
FACEBOOK OPEN GRAPH 
********************************/

//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="377035309011137"/>';
        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="Zooming Japan - Your Personal Japan Guide"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
        $default_image="http://zoomingjapan.com/wp-content/themes/alltuts/images/linkback_600x156ver2.jpg"; //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 "\n";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Sharing now seems to work when I copy and paste the URL directly into Facebook but not via the Share or Like button on my blog. I'm not sure if it would help if the above code would be adjusted a bit?! Maybe I need to change the buttons. I'm currently using the iframe versions, I think. Furthermore, sharing doesn't work for all blog posts equally. Not sure why! http://zoomingjapan.com/travel/udo-shrine-in-miyazaki/ (this is one of the blog posts that still won't work ..)

Also, do you think there is a way to keep using the W3 Cache plugin without causing those problems?

Please help me out here! Thanks a lot in advance for any advice you can give me.

W3 Cache plugin and Facebook sharing

Updated Information:

I finally was able to figure out what was wrong thanks to Milo and MathSmath! The W3 Cache Plugin is interfering with the Facebook sharing progress, but it's quite easy to change that. Scroll down to see my answer! Works like a charm!

Tweeted twitter.com/#!/StackWordPress/status/212674236580503552
deleted 18 characters in body; Post Made Community Wiki
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40

Sharing on Facebook works now in some cases. The title and meta description appear, but the thumbnail just won't load. It seems to keep looking for something, but nothing is loading. Any idea how to solve that? Depending on the blog post, it still doesn't work.

Also ... I want to keep using the Cache plugin, is there a chance to get it to work with the Facebook Sharer? ..

EDIT: Also,After I took this out the following of my function.php!, I don't get any error messages from the Debugger anymore (only warnings), but sharing still doesn't work:

Sharing now seems to work when I copy and paste the URL directly into Facebook but not via the Share or Like button on my blog. I'm not sure if it would help if the above code would be adjusted a bit?! Maybe I need to change the buttons. I'm currently using the iframe versions, I think. Furthermore, sharing doesn't work for all blog posts equally. Not sure why! http://zoomingjapan.com/travel/udo-shrine-in-miyazaki/ (this is one of the blog posts that still won't work ..)

Also, do you think there is a way to keep using the W3 Cache plugin without causing those problems?

Sharing on Facebook works now in some cases. The title and meta description appear, but the thumbnail just won't load. It seems to keep looking for something, but nothing is loading. Any idea how to solve that? Depending on the blog post, it still doesn't work.

Also ... I want to keep using the Cache plugin, is there a chance to get it to work with the Facebook Sharer? ..

EDIT: Also, I took this out of my function.php! I don't get any error messages from the Debugger anymore (only warnings), but sharing still doesn't work:

After I took out the following of my function.php, I don't get any error messages from the Debugger anymore (only warnings):

Sharing now seems to work when I copy and paste the URL directly into Facebook but not via the Share or Like button on my blog. I'm not sure if it would help if the above code would be adjusted a bit?! Maybe I need to change the buttons. I'm currently using the iframe versions, I think. Furthermore, sharing doesn't work for all blog posts equally. Not sure why! http://zoomingjapan.com/travel/udo-shrine-in-miyazaki/ (this is one of the blog posts that still won't work ..)

Also, do you think there is a way to keep using the W3 Cache plugin without causing those problems?

added 1833 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40

EDIT: Also, I took this out of my function.php! I don't get any error messages from the Debugger anymore (only warnings), but sharing still doesn't work:

/*******************************
FACEBOOK OPEN GRAPH 
********************************/

//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="377035309011137"/>';
        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="Zooming Japan - Your Personal Japan Guide"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
        $default_image="http://zoomingjapan.com/wp-content/themes/alltuts/images/linkback_600x156ver2.jpg"; //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 "\n";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Please help me out here! Thanks a lot in advance for any advice you can give me.

Please help me out here! Thanks a lot in advance for any advice you can give me.

EDIT: Also, I took this out of my function.php! I don't get any error messages from the Debugger anymore (only warnings), but sharing still doesn't work:

/*******************************
FACEBOOK OPEN GRAPH 
********************************/

//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="377035309011137"/>';
        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="Zooming Japan - Your Personal Japan Guide"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
        $default_image="http://zoomingjapan.com/wp-content/themes/alltuts/images/linkback_600x156ver2.jpg"; //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 "\n";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Please help me out here! Thanks a lot in advance for any advice you can give me.

added 812 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
added 54 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
added 395 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
deleted 53 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
added 20 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
added 312 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
latest update
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
Notice added Improve details by japanworm
Bounty Started worth 50 reputation by japanworm
added 323 characters in body; edited title
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
added 1909 characters in body
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading
Source Link
japanworm
  • 577
  • 3
  • 19
  • 40
Loading