vendredi 23 octobre 2015

Facebook error : This content is no longer available. How to resolve it?

i recently created a wordpress blog for one of my client and added SUMOME for the social sharing, well sumome is a social sharing plugin available for wordpress. Initially it was working fine but i dont know why it is kind of acting little weird. Now when ever i try sharing it on facebook it gives me an error saying

This content is no longer available
The content you requested cannot be displayed right now. 
It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page.

i tried putting the open graph meta tags and included the following code in my functions.php

function doctype_opengraph($output) {
return $output . '
xmlns:og="http://ift.tt/OQX3IK"
xmlns:fb="http://ift.tt/zbanWc"';
}
add_filter('language_attributes', 'doctype_opengraph');

function fb_opengraph() {
   global $post;

   if(is_single()) {
     if(has_post_thumbnail($post->ID)) {
        $img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium');
    } else {
        $img_src = get_stylesheet_directory_uri() . '/img/opengraph_image.jpg';
    }
    if($excerpt = $post->post_excerpt) {
        $excerpt = strip_tags($post->post_excerpt);
        $excerpt = str_replace("", "'", $excerpt);
    } else {
        $excerpt = get_bloginfo('description');
    }
    ?>

<meta property="og:title" content="<?php echo the_title(); ?>"/>
<meta property="og:description" content="<?php echo $excerpt; ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo $img_src; ?>"/>

<?php
 } else {
     return;
 }
 }
 add_action('wp_head', 'fb_opengraph', 5);

so can someone help me out with this. I also tried using yoast seo..but still with no luck



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire