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

I have set the following custom permalink structure (for my blog):


When I browse to /news I was expecting for the archive.php template to be served up, unfortunately, I'm presented with a 404.

My rewrite is working properly since I can view all posts such as /news/my-post-title.

How can I make it so that my "archive.php" is served up when browsing to /news, currently I have to create a dummy News page which is of course what I don't want.

Any help would be much appreciated.


I have set my Category Base and Tag Base permalinks as follows:


Browsing to /news/categorized/test triggers the category.php template and browsing to /news/tagged/test brings me to the tag.php template.

I still have no luck in triggering the archive.php.

share|improve this question
is news a custom post type? or just the page for your blog? – Alex Older Feb 23 '12 at 11:47
This is just for built-in posts, not a custom post type. For some reason, custom post types seem to handle this just fine. – Luke Feb 23 '12 at 20:20
Do you have a page called news? – Alex Older Feb 24 '12 at 9:35
I don't have a page called "news". It's the whole point that I don't have to create "dummy" pages. I was expecting that my "archive.php" would be triggered instead. – Luke Feb 24 '12 at 21:32
if you browse to news/archive does it work? – Alex Older Feb 25 '12 at 9:48
up vote 1 down vote accepted

You can override the Post type object settings in the init action and register the proper values for the archive and rewrites:

add_action('init', 'my_init');

function my_init()
   $args = objectToArray( get_post_type_object('post') );

   $args['has_archive'] = 'news';
   $args['rewrite'] = array(
      'slug' => 'news',
      'with_front' => FALSE,

   register_post_type('post', $args);

function objectToArray( $object )
   if( !is_object( $object ) && !is_array( $object ) )
      return $object;

   if( is_object( $object ) )
      $object = get_object_vars( $object );

   return array_map('objectToArray', $object);

By specifying the has_archive and the rewrite values for the Post type object it's possible to force Wordpress the same behavior as one would do for Custom Post types.

Wordpress should now pick up the archive.php template when browsing to /news.

The only clumsy thing about this is of course that get_post_type_object returns an object version of the array that register_post_type takes as a parameter, hence the objectToArray helper function.

share|improve this answer

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.