I am trying to attach a simple function to the Yoast SEO filter hook wpseo_sitemap_urlimages
and get the function to run, but I cannot do so. My code is:
function tp_filter_wpseo_sitemap_urlimages($images, $post_id) {
error_log("test message");
return $images;
}
add_filter('wpseo_sitemap_urlimages', 'tp_filter_wpseo_sitemap_urlimages');
To get this function to run, I have tried opening the following Yoast XML sitemaps:
- sitemap index (https://example.com/sitemap_index.xml)
- post sitemap (http://example.com/post-sitemap.xml)
- page sitemap (http://example.com/page-sitemap.xml)
My eventual goal with this is to add additional images to the Yoast post and page sitemaps (per these Yoast instructions).
The only support Yoast has offered for this is to direct me to this page.