Sitemap not working with Envira Gallery plugin

#99833
  • Resolved Daniel Bigaj
    free

    Hi, my sitemap is not loading images I have in Envira image galleries on my site.

    Example page not showing images in sitemap: https://jasmineschut.ca/gallery/paintings/

    Sitemap: https://jasmineschut.ca/sitemap_index.xml

    As far as I can tell I have enabled all the settings I need to detect images. I think Envira is not compatible with Rank Math. I have inquired with them to add that functionality but it is not guaranteed that they will. Is there some code that I could add to my functions.php file to get it to work in the meantime?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    If the Envira Image plugin has some code to get the URL of every image in the gallery, you could use the following filter to check if the current page is one with the gallery, and if it is, get every image there and add them to the sitemap:

    /**
     * Filter images to be included for the post in XML sitemap.
     *
     * @param array $images  Array of image items.
     * @param int   $post_id ID of the post.
     */
    add_filter( 'rank_math/sitemap/urlimages', function( $images, $post_id ){
    	return $images;
    }, 10, 2);

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Sorry it appears I have accidentally made two tickets, I have added login details to my other ticket.

    https://support.rankmath.com/ticket/images-from-galleries-not-appearing-in-sitemap/?view=all

    Hello,

    It is fine, I have already answered the other one. I will close this one to avoid duplicated conversations.

    Looking forward to help you.

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

The ticket ‘Sitemap not working with Envira Gallery plugin’ is closed to new replies.