• Resolved ahojdane

    (@ahojdane)


    Hello, is it possible to change the source of OG image file?

    From this:

    	<meta property="og:image" content="https://www.wp.com/wp-content/uploads/2024/08/image.jpg" class="yoast-seo-meta-tag" />
    <meta property="og:image:width" content="1920" class="yoast-seo-meta-tag" />
    <meta property="og:image:height" content="2560" class="yoast-seo-meta-tag" />

    To something like this:

    	<meta property="og:image" content="https://www.wp.com/wp-content/uploads/2024/08/image-768x1024.jpg" class="yoast-seo-meta-tag" />
    <meta property="og:image:width" content="768" class="yoast-seo-meta-tag" />
    <meta property="og:image:height" content="1024" class="yoast-seo-meta-tag" />

    I want to use smaller image, which is automatically generated by WP (medium size). From some reason the image in highest resolution is not available on my website.

    I tried this from your webpage, but it is not working:

    function yoast_seo_opengraph_change_image_size() {
    return 'medium';
    }
    add_filter( 'wpseo_opengraph_image_size', 'yoast_seo_opengraph_change_image_size' );

    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @ahojdane

    Thanks for using the Yoast SEO plugin. If an?og:image?already exists for the page/post/archive, it is replaced by the new one returned by the filter. If there is no?og:image, nothing is done by the filter. You can find the filter here.

Viewing 1 replies (of 1 total)
  • The topic ‘How to change OG image’ is closed to new replies.