Exclude / Include categories for wp_get_archives tag

  1. mmarauder

    To explain what I mean I'll give an example.
    I have a website with 4 different categories for the articles and then I have an additional category for the calendar.
    The wp_get_archives template tag includes everything so when I display a monthly archive for the articles, those are polluted with all the entries for the calendar that shouldn't be there.

    Considering the number of forums where people ask about how to get around this problem, I'm sure this would be a very welcome improvment.

    If you agree with me, please vote!

    Posted: 7 years ago #
  2. Justin Tadlock
    WordPress God

    Why not just run a filter on pre_get_posts while on archive pages? This doesn't seem like a wp_get_archives() issue.

    I'm also not sure what your "calendar" feature is. But, it sounds like those entries might need to be handled with a custom post type.

    Posted: 7 years ago #
  3. Andy Macaulay-Brook


    If you want to stick with using a category for what is essentially a data type outside of your blog posts then there are plugins that help you do this - search for 'exclude categories.'

    However, Greenshady is right that this sort of thing is more elegantly done with custom post types. He has plenty of explanation about it on his own site.

    Posted: 7 years ago #
  4. Randy

    I feel like what he's asking for is more like an archives widget that would print out an li list of months that linked to a single category in that particular month and year e.g. ?cat=5&m=201010

    I'm thinking of adding the last key=>val to the array below and having the links point to ?taxonomy=term_id&m=Ym


    'type' => 'monthly',
    'limit' => '',
    'format' => 'html',
    'before' => '',
    'after' => '',
    'show_post_count' => false,
    'echo' => 1,
    // added
    'taxonomy' => array(
    'taxonomy' => taxonomy,
    'include' => term_ids,

    however, if permalinks are turned on ?cat=5&m=201010 gets stripped to ?cat=5

    in the end it would be cool to have:

    Which is another topic.

    Posted: 7 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    4 Votes
  • Status

    This idea is under consideration