• Resolved goupilgraph

    (@goupilgraph)


    Hello,

    By consulting the sitemap of my site I noticed that there was only one image listed per product while there are 3 or 4.(https://moonlightcreations.fr/shop/paper-packs/knitted-digital-paper/)
    The featured image is listed. The other images are in a gallery and I read that depending on the themes, Yoast couldn’t find those images.
    I am using Avada theme.

    It is written to use the filter wpseo_sitemap_urlimages

    I tried but nothing changes. I emptied my caches.

    I am using this code in my functions.php file of my child theme. Is this correct ?

    function filter_wpseo_sitemap_urlimages( $images, $post_id ) { 
      array_push($images, 'https://moonlightcreations.fr/wp-content/uploads/2021/05/school-digital-paper-chalky-printable-design-chalk-paper-scrapbooking-collection-chevron.jpg');
      return $images; 
    }; 
    add_filter( 'wpseo_sitemap_urlimages', 'filter_wpseo_sitemap_urlimages', 10, 2 );

    Thank you for helping me.

    • This topic was modified 4 years, 1 month ago by goupilgraph.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello Goupilgraph,

    Thanks for reaching out about your gallery images.

    As you rightly mentioned, adding the filter wpseo_sitemap_urlimages to your functions.php file will register images from page builders to the sitemap. Kindly refer to this to see how to implement it as I am unable to review your code.

    Thanks.

    Thread Starter goupilgraph

    (@goupilgraph)

    Thanks for responding so quickly.

    I’m not really familiar with PHP. Nobody here can validate me or correct me the code please?

    Plugin Support Michael Tiña

    (@mikes41720)

    Hi,

    We aren’t able to validate or confirm if the usage of the wpseo_sitemap_urlimages filter is correct as it’s outside our scope of support. We also wouldn’t want to suggest incorrect code that might break your site. We recommend that you reach out to your web developer or programmer for further assistance on this – https://yoast.com/help/images-in-the-xml-sitemap/

    We’ll also be leaving this forum thread open for a few days just in case any users want to help or provide further advice. Thanks for your understanding!

    Jeroen Rotty

    (@jeroenrotty)

    I marked this thread as resolved due to a lack of activity by the original poster. The original poster is always welcome to re-open this topic.

    If you are not the original poster but have a similar issue, please read this post before opening a new request.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Missing gallery images’ is closed to new replies.