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'm coming back to WordPress after quite a hiatus (and it's not my normal CMS framework), and I'm working with custom post types for the first time.

I'd like to have 2 page templates that support section pages with URLs such as:

  • mydomain.com/apples/
  • mydomain.com/oranges/

And then have 2 single post templates -- one for an apples custom post type, and one for an oranges custom post type -- that support URLs such as:

  • mydomain.com/apples/foo
  • mydomain.com/oranges/bar

But when I created templates such as:


…I found that the page URL was rendering fine but single post URLs were returning 404.

I realised that, when registering the custom post types, adding 'with_front' => false as an argument of rewrite enabled single post URLs to render, but then of course the section page URL didn't!

The solution I have at the moment is to register the custom post types in the singular form of the custom post keyword, so now I have:


Which means the corresponding URL schema has to be a mixture of plural (for the section page) and singular (for the custom post type):

  • mydomain.com/apples/
  • mydomain.com/apple/foo

I can live with this if I have to, but I'd rather have the URL schema be consistently plural.

I'd be grateful of any suggestions for how to do things differently.

Update: as requested, here's an example of how I'm registering one of the custom post types (in the singular form but with a plural Admin menu label)…

register_post_type( 'apple', array(
  'labels' => array(
    'name' => __( 'Apples' )
  'taxonomies' => array('category'),
  'public' => true,
  'rewrite' => array(
    'slug' => 'apple',
    'with_front' => false
  'has_archive' => true
share|improve this question
Post the code you are using to register the post types please. – s_ha_dum Jun 1 '14 at 14:56
Thanks, I've updated the question with some example code. – Jonathan Schofield Jun 1 '14 at 16:17
has_archive should be false, since you are using a page instead of the default post type archive. otherwise, If you remove that conflict, I don't see any reason why what you want shouldn't be working. – Milo Jun 1 '14 at 18:14

Your Answer


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

Browse other questions tagged or ask your own question.