By default, the official WordPress Jetpack plugin doesn’t support Woocommerce sites when it comes to generating sitemaps. It totally leaves out woocommerce product pages and only adds regular pages and posts.
Below is how I was able to get the sitemap to start including products on my sister’s woocommerce site.
If you know how to mess around with wordpress code, simply copy and paste the code below into your functions.php or wherever you add extra wordpress code, save and you’re good to go.
add_filter( 'jetpack_sitemap_post_types', 'htdat_jetpack_sitemap_post_types' );
function htdat_jetpack_sitemap_post_types( $post_types ) {
$post_types[] = 'product';
return $post_types;
}
If you don’t know how to mess with code, do please follow this guide to deploy the code on your website >> Add PHP Code Without Editing Files.
The changes to the sitemap won’t be reflected immediately but eventually they will.
You can try adding a new product or post or page to your woocommerce site, to trigger Jetpack into regenerating the new sitemap faster.
That’s all. Hope this helps
H/T: apply_filters ( ‘jetpack_sitemap_post_types’ )
Discover more from Patchwork Of Tips
Subscribe to get the latest posts sent to your email.
You’ll also like:
Please share this article to help others. Thanks