• Resolved Daniel Chase

    (@riseofweb)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Guga Alves

    (@gugaalves)

    Hi Daniel,

    I believe we can’t say that this is a bug produced by our plugin as it is the SEO plugin that is creating those sitemap files and not removing the duplicates.

    Your snippet should be the best workaround for that. Anyway, I’ll let our developers know about that and check if there’s some way to prevent that from our side.

    Best Regards.

    @riseofweb

    Hey there! This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help. ??

    Best,
    Rob

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug with Yoast SEO’s sitemap, extra Links using WooCommerce and this plugin’ is closed to new replies.