Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So, I've got an entirely custom theme which has a number of custom post-types.

I've also got a custom taxonomy which I can visit on the front end with URLs such as:

www.mysite.local/custom-tax/custom-term

Which runs a query giving me results of posts that match the term 'custom-term' in the tax 'custom-tax'. Also paginates, etc.

When it comes to the custom post type pages, e.g. I've got a CPT of 'submissions' with the permalink slug set to 'your-reviews', the backend suggests the permalink will be:

www.mysite.local/your-reviews/my-new-awesome-post/

Which 404's.

I've checked out the WP template hierarchy and everything falls back to index.php which routes to the various custom templates that need to be used depending on the part of the site the user is visiting etc. So if I change the first line in index.php to a

die
or
wp_die

I'd expect no matter which page I visit, I'd always get the message in the die statement even for the 404'ing custom post type page.

It's worth noting that I get a 404 whether I visit the 'archive' page at:

www.mysite.local/your-reviews/

Or the individual page (some of which are 'hierarchical' and produce a permalink such as (the non-hierarchical pages also 404).

www.mysite.local/your-reviews/my-parent/my-new-awesome-post/

Updated

So, the code that generates this specific CPT (alongside a few others) is:

define( 'LL_POSTTYPE_ONELINER', 'll_submissions' );

$args = array(
    'label' => __('Submissions'),
    'labels' => $labels,
    'public' => true,
    'can_export' => true,
    'show_ui' => true,
    '_builtin' => false,
    '_edit_link' => 'post.php?post=%d', // ?
    'capability_type' => 'post',
    'menu_icon' => get_bloginfo('template_url').'/images/thumb_up.png',
    'hierarchical' => true,
    'rewrite' => array( "slug" => "submissions" ),
    'supports'=> array('title', 'thumbnail','page-attributes' ) ,
    'show_in_nav_menus' => true,
    'query_var' => true,
    'taxonomies' => array()

);

register_post_type( LL_POSTTYPE_ONELINER, $args);

Note, whilst this one's marked as 'hierarchical' => 'true', others that aren't hierarchical also 404 in the same way.

And to follow up, from the reply I've had so far, out of the template hierarchy (single.php, etc...) I only have index.php which it never hits.

share|improve this question
    
If you are asking how to fix your CPT permalink issue, I recommend including the code used to create the CPT. –  Rachel Baker Jul 29 '12 at 23:02
    
You say the URL will be 'your-reviews' but the registration code says the slug is actually: 'rewrite' => array( "slug" => "submissions" ), –  Tom J Nowell Jul 30 '12 at 12:33
    
Try www.mysite.local/submissions/my-new-awesome-post/ –  Tom J Nowell Jul 30 '12 at 12:34
    
I tried changing the code in case WP didn't like /your-reviews/ to submissions (and flushed permalinks) and it's made no difference unforuntately. –  gravy Jul 30 '12 at 14:06

2 Answers 2

Your Custom Post Type is using the single.php and (most likely) archive.php templates.

A single CPT post looks for templates in this order:

  • single-{post_type}.php - If the post type were product, WordPress would look for single-product.php
  • single.php
  • index.php

Other CPT pages look for templates in this order:

  • taxonomy-{taxonomy}-{slug}.php
  • taxonomy-{taxonomy}.php - If the taxonomy were sometax, WordPress would look for taxonomy-* sometax.php
  • taxonomy.php
  • archive.php
  • index.php
share|improve this answer
    
So, assuming my theme doesn't have any of the above except for the index.php (it doesn't) then it should hit index.php, and then trip the die statement? This is kinda my problem... –  gravy Jul 29 '12 at 23:06
    
Are the only files in your theme index.php and a functions.php? If not, what files exist? –  Rachel Baker Jul 30 '12 at 15:15
    
Sorry for the late reply, got locked out of my G account, there's an index php, no single, no archive. Some how I've got single CPT pages working (yey) but the archive URL still never hit index.php-- I'm not even sure where to start debugging if I can't get to the die command in line one of index.php. Is there a script that routes into a template file that I can bob some debug code in? –  gravy Aug 5 '12 at 11:10

Have you flushed your permalinks? Whenever you change a Custom post type or taxonomy you must flush permalinks else you'll get 404s

share|improve this answer
    
Yeah, I tried this, didn't help unfortunately :( –  gravy Jul 30 '12 at 11:01

Your Answer

 
discard

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.