Bug with Yoast SEO’s sitemap, extra Links using WooCommerce and this plugin
-
The Yoast SEO plugin creates a sitemap.xml for search engines. When using the Events Tickets plugin with WooCommerce, Yoast SEO adds the ticket products as an event link to the product-sitemap.xml. Also if you have multiple ticket types for a single event it will add duplicate links there as well.
It is not ideal to have duplicate sitemap links for a webpage. The events sitemap (tribe_events-sitemap.xml) already has the event link so it is not necessary to have these duplicate links in the products sitemap (product-sitemap.xml).
One work around is for all WooCommerce ticket products to manually change the Yoast SEO settings for search engines to not index it.
Here is my workaround to do this to all WooCommerce products. In my theme’s functions.php I added this:
/* Remove Duplicate WooCommerce Products in the XML Sitemap from Tribe Events */ function sitemap_remove_unwanted( $url, $post ) { if ( $post->post_type === 'product' && strpos($url, 'event') !== false ) { //do nothing - note that 'event' is the directory in my URL structure and you may need to adjust that depending on your URLs } else{ return $url; } } add_filter( 'wpseo_xml_sitemap_post_url', 'sitemap_remove_unwanted', 10, 2 );
This might be something the Event Ticket’s developers need to address or at least maybe others might benefit from my code.
- The topic ‘Bug with Yoast SEO’s sitemap, extra Links using WooCommerce and this plugin’ is closed to new replies.