如何修复facebook.com/dialog/return/close?#_=_



当我点击分享Facebook按钮时,我被引导到 **facebook.com/dialog/return/close ? # _ = _

所有停在这里。只是一张白纸。我试过各种"社交分享按钮"插件,在Facebook按钮上发现了同样的问题。这个发生在移动端浏览器上。我可以重定向此操作的URL吗?我如何解决这个问题?谢谢。

我刚找到另一个函数。我认为不是正确的答案或者它的不能解决问题。但是,在我把这段代码放到我的主题的function.php上之后,一切都好了。

    // fix share 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="YOUR USER ID"/>';
        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="KALTARA CENTER"/>';
    if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
        $default_image="https://scontent-sin6-1.xx.fbcdn.net/v/t1.0-9/12743574_1707554466145558_2816765664534740995_n.jpg?oh=e9bac3fd82d2717505136a02c083045e&oe=588CFEF4"; //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_post_thumbnail(array(200,200), array('class' => 'alignleft'));

您可以添加另一个答案。我希望你有解决这个问题的办法

最新更新