• Resolved Rafa?

    (@ayek)


    Dear Support Team,

    How can I use AVIF images in Social tab (Open Graph protocol) on my own risk?

    Now (Yoast v. 24.2) we get notice:
    The format of the uploaded image is not supported. The supported formats are: JPG, PNG, WEBP and GIF.

    AVIF thumbnail is shown in the editor, but URL is not attached in HTML output of <head> (the default is used).

    PS
    Rank Math allows AVIFs
    Facebook does support AVIFs
    X – doesn’t

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Mushrit Shabnam

    (@611shabnam)

    Hi @ayek

    You can use the filter wpseo_opengraph_image to modify and add the image of your preference.

    We have a developer portal with more information about filters and many examples of how to implement them.

    Typically code snippets are added to your theme’s functions.php file. If you’re unfamiliar with using code snippets, we’d like to refer you to the WordPress documentation on how to use a filter.

    We recommend creating regular backups of your site and database for your site’s health and safety. A backup is crucial before making important changes on your website and provides you with a safety net if something were to go wrong. Learn more about the benefits of regular backups.


    Plugin Support Jose Varghese

    (@josevarghese)

    This thread was marked resolved due to a lack of recent activity. The original poster can change the status to Not Resolved to re-open the issue or open a new topic.

    If you are not the original poster but have a similar issue, please open a new topic.

    Thread Starter Rafa?

    (@ayek)

    Hi
    Sorry, I couldn’t find suitable method to allow AVIF in Social tab.

    I use workaround which as OG:image gets featured image, even if it’s in AVIF format

    add_filter('wpseo_opengraph_image', 'use_featured_image');
    function use_featured_image($img) {
    // Get the current post ID
    $post_id = get_the_ID();

    // Check if Yoast SEO has a social image set
    $yoast_social_image = get_post_meta($post_id, '_yoast_wpseo_opengraph-image', true);

    // Only use featured image if no Yoast social image is set
    if (empty($yoast_social_image) && has_post_thumbnail($post_id)) {
    $img = get_the_post_thumbnail_url($post_id, 'full');
    }
    return $img;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.