Support » Plugin: WP Sitemap Page » How to exclude a category

  • I’d like to exclude a single category. Currently my shortcode reads as follows:

    [wp_sitemap_page only="category" sort="menu_order" display_category_title_wording="false" display_title="false"]

    I have added the category id to the exclude pages box just in case, but that does not work. I don’t see a shortcode to exclude a category.

    I see the plugin has not been maintained, but has anyone here found a way to do this?

    Thanks for any insights.

    • This topic was modified 1 year, 4 months ago by 2mooses.
Viewing 7 replies - 1 through 7 (of 7 total)
  • I need same options

    In fact, Exclude taxonomies in the settings does not have checkbox. There appears to be an error in coding for setting. The plugin needs updating and code polishing.

    Sorry… I had removed the nesting. Hence, it is not showing the checkbox for Exclude Taxanomies.

    an147

    (@an147)

    Hi guys!
    I patched it a bit on a website to exclude a category for my client’s online store.
    So..

    Search file wp-sitemap-page.php right in the plugin folder. Go to line 1034 inside wsp_return_content_type_taxonomy_items function.
    Here is the code:

    // init variable to get terms of a taxonomy
    	$taxonomies = array( $taxonomy_name );
    	$args = array();

    Replace it with:

    $exclude_pages_array = array_map('trim', explode(',', $wsp_exclude_pages));
    	
    	// init variable to get terms of a taxonomy
    	$taxonomies = array( $taxonomy_name );
    	$args = array(
    		'exclude' => $exclude_pages_array,
    	);

    Enjoy!

    P.S. I know: it’s not good to patch plugins, because you need to disable this plugin updates. But this is the hotfix I use.

    • This reply was modified 7 months ago by an147.

    Hi @an147,

    thank you for the hint!

    I’ve just done with the replacement of the code snippet.

    How can I choose which post category will be hidden?

    Thank you,
    David

    @nemethszeged
    Just input IDs of categories you want to exclude on plugin settings page (text input where you exclude posts by IDs too).
    You can install any plugin like ‘Reveal IDs’ to see posts/categories IDs right on All Categories pages.

    • This reply was modified 1 month, 3 weeks ago by an147.

    @an147 thank you!

    I just did what you have recommended:
    1) replaced the code
    2) put IDs, where I can exclude post IDs.

    Unfortunately, it is still not working for categories. 🙁

    Any idea?

    This is the page, where the sitemap is located:
    https://karteritesblog.hu/oldalterkep/

    The category that should be hidden is ‘Ügyfelek (általános)’.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.