WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If my category URL is:


and my archive URL is:


what's the URL for 'foo' blogs from February 2011?

share|improve this question
/blogs/category/foo/?y=2011&monthnum=02 – t31os Feb 7 '11 at 21:23
@t31os: If you move that to an answer we could expand it with rewrite rules, so it has nice urls! – Jan Fabry Feb 8 '11 at 10:10
Wouldn't any rules written for such a URL conflict with the sub-category rules though? I think that's why no such rules exist, how can you differentiate between a category URL that's date based, and one that's simply a sub-caegory URL. You're welcome to factor in my suggestion to your own answer if you like. – t31os Feb 8 '11 at 10:33
@t31os: Hmm, it should be possible... With a non-greedy regex, and because the date archive ends with digits. I'll think about it and maybe come back with a complete answer! – Jan Fabry Feb 8 '11 at 12:47
@t31os: I expanded my answer with rewrite rules that add date-based browsing. As I thought, the non-greedy rewrite rules make this possible. – Jan Fabry Feb 9 '11 at 15:00

There is no date-based archive for a category. The /category/[slug]/ pages are already "archives", in that they display old posts over different pages.

The different pages can be accessed by adding page/2/, page/3/, ... to the URL. The template tags to add these links are next_posts_link() and previous_posts_link().

If you want to add a date-based layer to your category archives, you can add a rewrite rule to match a year, optional month and optional paging.

add_filter( 'category_rewrite_rules', 'wpse8769_category_rewrite_rules' );
function wpse8769_category_rewrite_rules( $category_rules )
    global $wp_rewrite;
    // This could be incorrect for fancy permastructs, only tested in simple situations
    $category_permastruct = str_replace( $wp_rewrite->rewritecode, $wp_rewrite->rewritereplace, $wp_rewrite->get_category_permastruct() );
    $category_permastruct = preg_replace( '|^/+|', '', $category_permastruct );

    $category_extra_rules = array(
        // Or split this up over different rewrite rules, if the regex is too complicated
        // Feeds are left as an exercise for the reader
        $category_permastruct . '/([0-9]{4})(/([0-9]{1,2}))?(/page/([0-9]+))?/?$' =>

    return $category_extra_rules + $category_rules;
share|improve this answer
My /category/[slug]/ URL only displays the most recent 10 posts, with no links to any others. Is there a way I can paginate them? – Bobby Jack Feb 7 '11 at 18:28

Q: what's the URL for 'foo' blogs from February 2011?

The URL in the context of your site is: /blogs/category/foo/?y=2011&monthnum=02

(I blatantly copied this over from a commment t31os, so credits to him for this)

share|improve this answer
Unfortunately, that doesn't quite work. It limits the month to February OK, but the year filter doesn't take effect, so I end up with posts from Feb 2011, Feb 2010, etc. – Bobby Jack Feb 11 '11 at 11:35
... and if I change it from "y=2011" to "year=2011", I get redirected to /blogs/2011/02/ thus losing the category – Bobby Jack Feb 11 '11 at 11:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.