簡體   English   中英

WordPress的og:圖像無法在WhatsApp的?

[英]Wordpress og:image not working in whatsapp?

我創建了一個Wordpress新聞網站。 實現了許多共享選項! 我添加了WhatsApp,並將URL發送到WhatsApp,並共享到WhatsApp! 問題是,當我在WhatsApp中共享鏈接時,最初會顯示帖子圖像。 但是,當我在WhatsApp中共享鏈接時,現在沒有圖像顯示! 在Facebook上分享時沒有任何問題! 當我檢查頁面源代碼時,WordPress會自動將og:image作為發布功能圖片! 但它不會顯示在WhatsApp中。 但是,當我復制相同的og:image到header.php時,我的WordPress效果很好! 最初,我想到了大小問題,后來發現大小符合og:image元標記標准。

在這里,我發布了single.php代碼:

<?php
/**
 * NewsGamer Theme
 *
 * Theme by: MipThemes
 * http://themes.mipdesign.com
 *
 * Our portfolio: http://themeforest.net/user/mip/portfolio
 * Thanks for using our theme!
 *
 */

// load header
get_header();

// Get Page properties
$mip_current_page   = new MipThemeFramework_Page();

// Update Post View
MipThemeFramework_Post_Views::update_post_views($post->ID);

// Load Custom post headers
get_template_part( 'elements/parts/post-header-'. $mip_current_page->page_template .'' );
?>

    <!-- start:post-info-bar -->
    <?php if ($mip_current_page->enable_post_info_bar) get_template_part( 'elements/post-info-bar' ); ?>
    <!-- end:post-info-bar -->

    <!-- start:page content -->
    <div id="page-content" class="<?php echo esc_attr($mip_current_page->page_template_class); ?> clearfix">

        <?php
            //get sidebar
            if ( ($mip_current_page->page_sidebar_template == 'left-sidebar')&&(!wp_is_mobile()) ) get_sidebar();
        ?>

        <!-- start:main -->
        <div id="main" class="main article">
            <!-- start:article post -->
            <article id="post-<?php echo esc_attr($post->ID); ?>" <?php post_class('article-post clearfix'); ?> <?php echo MipThemeFramework_Util::get_item_scope( $mip_current_page->review_post ); ?>>
            <?php
                if (have_posts()) :
                    // Get Template
                    get_template_part( 'elements/'. $mip_current_page->page_template .'' );
                else :
                    // No Posts
                    esc_html_e('No posts.', 'newsgamer');
                endif;
            ?>
            </article>
            <!-- end:article post -->
        </div>
        <!-- end:main -->

        <?php
            //get sidebar
            if ( ($mip_current_page->page_sidebar_template == 'right-sidebar')||( ($mip_current_page->page_sidebar_template == 'left-sidebar')&&(wp_is_mobile()) ) ) get_sidebar();
        ?>

    </div>
    <!-- end:page content -->

<?php
    // load footer
    get_footer();
?>

我遇到了同樣的問題,在任何opengraph測試工具以及他們自己的社交網站中,一切都工作正常:facebook,twitter,ok,vk,但在whatsapp和電報中卻沒有。

因此,經過大量研究,問題出在我們的虛擬站點防火牆中,該防火牆通過許多邏輯來防止站點爬網,其中包括IP和User-Agent。 whatsapp和電報ping站點以獲取og數據並不會像社交站點那樣將其扔到服務器上,而是通過移動運營商的動態IP進行,但用戶代理屬於Messenger本身,並且位於我們自動生成的黑名單中。

檢查您是否不通過其用戶代理字符串禁止訪問您的網站,該字符串包含: WhatsApp / 2.17.395 ATelegramBot(如TwitterBot)

希望能有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM