You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Woocommerce产品分享OG标签为空问题求助

Hey there, let's tackle this OG tag issue for your WooCommerce product page! I've looked into the problem you described—sharing your product only shows the link without images, descriptions, or proper OG tags, even after trying Yoast and Woo Open Graph plugins. Here are some actionable steps to fix this:

Troubleshooting Missing OG Tags on WooCommerce Product Pages
  • First, verify OG tag presence directly in the page source
    Open your product page, right-click > "View Page Source" (or Ctrl+U on Windows, Cmd+U on Mac). Search for og: tags (like og:title, og:image, og:description). If they're completely missing, that means the plugins aren't generating them at all—if they're present but incorrect, we'll focus on correcting their values.

  • Check for plugin conflicts
    Other plugins (caching, security, or custom code tools) often interfere with OG tag generation. Try this:

    1. Disable all plugins except WooCommerce and your chosen SEO/OG plugin (Yoast or Woo Open Graph)
    2. Test sharing the product link again, or recheck the page source for OG tags
    3. If it works, re-enable plugins one by one to identify the conflicting tool
  • Confirm your product data is fully filled
    Make sure your product has:

    • A featured image set (this is what should populate og:image)
    • A complete short description (many plugins use this for og:description; if empty, they might fall back to site-wide text or nothing)
    • A clear, unique product title (for og:title)
  • Manual OG tag implementation (if plugins fail)
    If the plugins still don't work, you can add custom OG tags via your theme's functions.php file or a code snippet plugin (like Code Snippets). Here's a tailored snippet for WooCommerce products:

    add_action('wp_head', 'custom_woocommerce_og_tags');
    function custom_woocommerce_og_tags() {
        if (is_product()) {
            global $product;
            $product_title = get_the_title();
            $product_description = wp_strip_all_tags($product->get_short_description() ?: $product->get_description());
            $product_image = wp_get_attachment_url($product->get_image_id());
            $product_url = get_permalink();
    
            echo '<meta property="og:title" content="' . esc_attr($product_title) . '" />';
            echo '<meta property="og:description" content="' . esc_attr($product_description) . '" />';
            echo '<meta property="og:url" content="' . esc_attr($product_url) . '" />';
            echo '<meta property="og:type" content="product" />';
            if ($product_image) {
                echo '<meta property="og:image" content="' . esc_attr($product_image) . '" />';
            }
        }
    }
    

    Note: Always back up your site before editing functions.php, or use a code snippet plugin to avoid breaking your theme.

  • Clear all caches
    Caching plugins (like WP Rocket, W3 Total Cache) or server-side caching might serve old page versions without updated OG tags. Clear your plugin cache, server cache, and browser cache before testing again.

  • Use social media debug tools to refresh cached data
    Social platforms often cache old versions of your page. Use tools like Facebook's Sharing Debugger to scrape the page again—this forces them to fetch the latest OG tags. Just enter your product URL and click "Scrape Again".


内容的提问来源于stack exchange,提问作者matheo972

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:11:14