I want to change the structure of yearly/monthly archive URL of default post type 'post'.

As we know be default the URLs are like:

Default: http://wwww.domain.com/2013/09

but want them rewritten, so end up like this:

New: http://wwww.domain.com/about/blog/archive/2013/09

i tried following but do seem to work:





I'd like someone to point to the right direction, need more info do leave a comment.


1 Answer 1


You can do this without adding rewrite rules by changing the $date_structure of the $wp_rewrite instance of the WP_Rewrite class:

function wpa116030_init(){
    global $wp_rewrite;
    $wp_rewrite->date_structure = 'about/blog/archive/%year%/%monthnum%/%day%';
add_action( 'init', 'wpa116030_init' );

Visit your Permalinks settings page after adding this code to flush the rewrite rules.

  • thanks, it worked like a dream. i have another query, can we do the same (rewrite) for the default post type slug? Sep 28, 2013 at 19:47
  • This doesn't work as expected if I change the "about/blog/archive" part to the name of my default category which is also the only category I have. In my case the category slug is pressemitteilungen and I want to have the date archive urls to be like this pressemtteilungen/%Year%/%month%/%day% so the url for august 2021 would become pressemitteilungen/2021/08. Because wordpress use the rule for category names above the rule for date archive it sets up the wrong env vars and therefore I get a 404. If I could change the order of the rewrite rules I believe it would work. But I don't know how. Aug 5, 2021 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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