• Resolved blu377

    (@blu377)


    Hello, I use (Ultimate Category Excluder) category excluder to exclude some categories from frontpage, I want these posts on sitemap too but they won’t show up.

    Is there a way to fix it?

    And, after I deactivated and deleted Simple Wp Sitemap plugin, when I try sitemap.xml or sitemap.html on browser, home page opens up instead of a 404 error.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Webbjocke

    (@webbjocke)

    Hi add this code to your functions.php. I think it should work:

    function sitemap_cat_fix ($q) {
        global $wp_query;
        if (isset($wp_query->query_vars['thesimplewpsitemap'])) {
            $q->set('category__not_in', false);
        }
    }
    add_filter('pre_get_posts', 'sitemap_cat_fix', 99);

    About when you deactivate it can sometimes take a while before the rewrite rules for the sitemaps disappear from your site. So wait a couple days but if it’s still not gone then check here: https://www.webhostinghero.com/3-ways-to-flush-the-rewrite-cache-in-wordpress/

    Thread Starter blu377

    (@blu377)

    Thanks a lot Webbjocke, I will try. Also thanks for this great plugin.

    • This reply was modified 8 years, 1 month ago by blu377.
    Thread Starter blu377

    (@blu377)

    Hello again, it fixed thanks a lot!

    Can I ask what 99 at the end of here “‘sitemap_cat_fix’, 99);” means?

    And does it split sitmap.xml say if I have more than 1000 posts?

    Plugin Author Webbjocke

    (@webbjocke)

    Great, no problems! It’s the priority for the function so it runs after Category Excluder and should in this case just be a number greater than 10. I set it to 99 to be safe ??

    Nope that’s what premium does. But it still works up to 5k posts. I think google for instance allows for about 50k posts in a sitemap, and if your server can handle it the 5k limit can just be changed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t use with category excluder’ is closed to new replies.