• Resolved timkainu

    (@timkainu)


    Hello,

    I am trying to get Facebook to share my post correctly by using Open Graph tags in my header.php file.

    By that, what I mean is when someone clicks the “Like” button on my post, I want the featured image, description and title to show up on the persons page who “Liked” it.

    All I get now is a URL with no description or image.

    When I use the debugger at https://developers.facebook.com/tools/debug/ and input the URL to my article – https://www.timkainu.com/oben-tripod-review/ – it gives me a bunch of errors.

    But when I turn off W3 Total Cache, everything works fine.

    Here are the open graph tags in my header.php file:

    <!-- the default values -->
    <meta property="fb:app_id" content="170151483038653" />
    <meta property="fb:admins" content="1570847387" />
    
    <!-- if page is content page -->
    <?php if (is_single()) { ?>
    <meta property="og:url" content="<?php the_permalink() ?>"/>
    <meta property="og:title" content="<?php single_post_title(''); ?>" />
    <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
    <meta property="og:type" content="w" />
    <meta property="og:image" content="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID)); }?>" />
    
    <!-- if page is others -->
    <?php } else { ?>
    <meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
    <meta property="og:description" content="<?php bloginfo('description'); ?>" />
    <meta property="og:type" content="website" />
    <meta property="og:image" content="https://www.timkainu.com/wp-content/uploads/2011/11/TimKainu_Default_Image.jpg" /> <?php } ?>

    Please let me know if you need any more info and I’d be glad to supply it.

    Thanks,
    Tim

    https://www.ads-software.com/extend/plugins/w3-total-cache/

Viewing 8 replies - 1 through 8 (of 8 total)
  • @timkainu
    i have the same problem, you find any solution?!?

    Andreas

    (@andreasnrb)

    timkainu: I see you solved the problem. Was it Total Cache settings or did you miss some FB code?
    Usual problem (I think) seems to be forgetting put the right stuff in the html opening tag.
    <html xmlns=”https://www.w3.org/1999/xhtml&#8221;
    xmlns:og=”https://ogp.me/ns#&#8221;
    xmlns:fb=”https://www.facebook.com/2008/fbml”&gt;

    Thread Starter timkainu

    (@timkainu)

    Well after a week of searching, I found the fix. You have to block W3 Total Cache from serving cached pages to Facebook’s bot/crawler. Make sure to reject these user agents in the “page cache” tab in W3 Total Cache:
    ————————-
    facebookexternalhit
    FacebookExternalHit/1.1
    FacebookExternalHit/1.0
    ————————-

    This will block W3 Total Cache from sending cached pages to Facebook. This solved my issue with thumbnails and descriptions.

    Andreas

    (@andreasnrb)

    Excellent work. Others have had issues as well fun to see you solved it.
    Could you mark this as resolved then?

    richardlin

    (@richardlin)

    @timkainu

    Wow, thanks so much! Problem solved.

    Saqib

    (@saqibk)

    Hi,

    I am also facing the same problem. But when I save the settings, I get this error:
    Disk enhanced page caching is not active. To enable it, add the following rules into the server configuration file (/home/technost/public_html/.htaccess) of the site above the WordPress directives. (View code) Or if permission allow this can be done automatically, by clicking here (auto install).

    I gave 777 permission to htaccess and then tried clicking on auto-install, but still the same message everytime.

    I also manually added the code in htaccess, but still the same message.

    Any guess what’s the problem here.

    I am just trying to reject these user agents, just as mentioned by @timkainu
    facebookexternalhit
    FacebookExternalHit/1.1
    FacebookExternalHit/1.0

    Plugin Contributor Frederick Townes

    (@fredericktownes)

    it’s really hard to guess without hands on checking in that release. Can you please submit a bug submission form from the support tab of the plugin?

    Thanks for the reply. Yes, I will submit that form from support tab.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘W3 Total Cache and Facebook Open Graph Errors’ is closed to new replies.