Support » Plugin: Jetpack by WordPress.com » Info for jetpack_sitemap_post_types

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You can find the filter here:
    https://github.com/Automattic/jetpack/blob/3.9.1/modules/sitemaps/sitemaps.php#L252

    To add a new Post Type to the array, you can paste in your theme’s functions.php file, or in a functionality plugin:

    function jeherve_add_cpt_sitemaps( $post_types ) {
    	$post_types[] = 'your_post_type';
    	return $post_types;
    }
    add_filter( 'jetpack_sitemap_post_types', 'jeherve_add_cpt_sitemaps' );

    Anybody had success with the code above? I have tried:

    function jeherve_add_cpt_sitemaps( $post_types ) {
    	$post_types[] = 'product';
    	return $post_types;
    }
    add_filter( 'jetpack_sitemap_post_types', 'jeherve_add_cpt_sitemaps' );

    and my WooCommerce products are not included in the sitemap. 🙁

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    @renatofrota It works in my tests, with the latest version of Jetpack and Woocommerce. Could you give it another try, and make sure the plugin where you’ve inserted the code is properly activated?

    Thanks!

    Hello, Jeremy

    Thanks for your reply!

    It seems the sitemaps are generated only when the cron runs – or somehow, scheduled – and after leaving the code there since yesterday, the sitemaps are now updated 🙂

    Now I just need to find out how to control the update frequency – and how to make Jetpack Sitemaps to have priority over AIO SEO plugin sitemap (a possibility I saw is setting AIO SEO to user a name other than “sitemap” for it’s sitemap, but I will look for other alternatives).

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    There is no delay, it’s updated as soon as you publish / delete a new post / page.

    how to make Jetpack Sitemaps to have priority over AIO SEO plugin sitemap (a possibility I saw is setting AIO SEO to user a name other than “sitemap” for it’s sitemap, but I will look for other alternatives).

    If you already use AIO SEO to generate a sitemap, you might not need to use Jetpack’s Sitemaps at all. Or is there a specific feature you use with both plugins’ sitemap modules?

    Hello, Jeremy

    Thanks for your reply, again!

    So maybe it’s somehow related to the network activated WP Super Cache I have? I have tried clearing the specific site’s cache and the sitemap wasn’t re-regenerated yesterday. I only saw a new sitemap published today. Anyway, I can now confirm the code snippet you wrote works! Thanks for it 😉

    I have also realized the frequency is not too important at all. And for the AIO SEO versus Jetpack, this is because I have some sites on the Network using AIO SEO and it overrides Jetpack sitemap’s – actually, I read it on Jetpack’s Sitemap page yesterday (and I want some flexibility – use Jetpack Sitemap, while AIO SEO is enabled). The main reasons for me to use Jetpack’s Sitemap module rather than AIO SEO’s one are:

    1. AIO SEO Sitemap module do publish all custom post types and taxonomies by default, including the media library attachments (and I prefer those not to be listed, so not having to go there and customize the AIO SEO options saves time).
    2. AIO SEO Sitemap module is not ‘human visitor proof’ when browsed using Chrome, only using Firefox, and some of my subsites are managed from non tech savvy people which will probably go nuts by seeing just a blank page on sitemap.xml

    However, I noticed after publishing my previous message, that both on Jetpack and AIO SEO, the sitemap generation feature are optional (I knew it is optional on Jetpack, but I wasn’t aware about AIO SEO – one of the other site admins setup AIO SEO for me – now I see it’s an optional module there too, like on Jetpack!), so I can enable AIO SEO and keep Jetpack’s Sitemap module enabled, and AIO SEO won’t override it, unless I enable the Sitemap module on it.

    TL;DR I’m all set. Many thanks again for your time!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    So maybe it’s somehow related to the network activated WP Super Cache I have?

    It could be. If it happens again, and if flushing the cache fixes the issue again, it might be worth updating your WP Super Cache settings to exclude the sitemaps from the cache.

    I can enable AIO SEO and keep Jetpack’s Sitemap module enabled, and AIO SEO won’t override it, unless I enable the Sitemap module on it.

    Yeah, that should do the trick! 🙂 I’m glad to hear you’re all set!

    Dear @jeremy thanks again for your support service at #WCPARIS2016

    I’ve add the functionnality plugin : https://wordpress.org/plugins/functionality/

    I’ve 21.151 products but now the sitemap stop at 1.000 lines

    How can add 21.151 woocommerce products on sitemap ?

    Thanks

    I’ve editing functions.php :

    <?php

    /*
    Plugin Name: Electronic components provider
    Plugin URI: http://electronicprovider.com
    Description: A site-specific functionality plugin for Electronic components provider where you can paste your code snippets instead of using the theme’s functions.php file
    Author: franck
    Author URI:
    Version: 2016.03.06
    License: GPL
    */

    function jeherve_add_cpt_sitemaps( $post_types ) {
    $post_types[] = ‘product’;
    return $post_types;
    }
    add_filter( ‘jetpack_sitemap_post_types’, ‘jeherve_add_cpt_sitemaps’ );

    Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer 🚀

    @franckparienti: Could you please start your own thread, as per the Forum Welcome?

    http://wordpress.org/support/plugin/jetpack#postform

    Thank you!

    Maxwell

    (@maxwellnorman)

    Hi everyone,

    How I can add a second post type?

    Should I make a function for each type or I can do it with the same function?

    Would welcome an example.

    Thanks in advance.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    How I can add a second post type?

    This should work:

    function jeherve_add_cpt_sitemaps( $post_types ) {
    	$post_types[] = 'your_post_type';
    	$post_types[] = 'your_other_post_type';
    	return $post_types;
    }
    add_filter( 'jetpack_sitemap_post_types', 'jeherve_add_cpt_sitemaps' );
    Maxwell

    (@maxwellnorman)

    This really works! 🙂

    Thank you very much for your response.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Info for jetpack_sitemap_post_types’ is closed to new replies.