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.

I've created 6 different custom post types, each with their own archive. I've also created a page with the same name as the custom post type, and a sub-page called 'About' for each.

For some reason, I'm only able to access the About page under one Custom Post Type, even though I've checked to make sure the code in functions.php is the exact same for all of them.

The live site is at test.isthispavilion.com; the code for each is:

add_action("init", "zac_init");

function zac_init() {
    $labels = array( 
        'name' => _x('Shrike', 'post type general name'), 
        'singular_name' => _x('Shrike', 'post type singular name'), 
        'add_new' => _x('Add New', 'shrike'), 
        'add_new_item' => __('Add New Piece'), 
        'edit_item' => __('Edit Piece'), 
        'new_item' => __('New Piece'), 
        'view_item' => __('View Piece'), 
        'search_items' => __('Search Pieces'), 
        'not_found' => __('No pieces found'), 
        'not_found_in_trash' => __('No pieces found in Trash'),
    );
    $args = array(  
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'shrike'),
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title', 'editor', 'author', 'custom-fields', 'thumbnail', 'revisions', 'page-attributes', 'post-formats', 'excerpt'),
        'taxonomies' => array('category', 'post_tag', 'portfolio'),
        'with_front' => false,
        'has_archive' => 'shrike',
    );

    register_post_type('shrike', $args, $taxonomies);
}

As you can see, http://test.isthispavilion.com/shrike/about/ works fine, but http://test.isthispavilion.com/darya/about/ is 'not found'.

Has anyone experienced a similar problem? What might be causing it?

share|improve this question
    
Go to "Settings" > "Permalinks" and click save one time. This flushes the rewrite rules. You should then be able to access your archives as well. –  kaiser Sep 4 '11 at 13:31
add comment

3 Answers

Haven't experienced this problem, but just looking into it a little bit I realized that you're capitalizing the page URL somehow.

The same link with a capital D works just fine.

Oliver link is doing the same thing, and a capital O fixes it

Hope this helps!

share|improve this answer
add comment

Hmm - I've had problems before with permalinks when using the same name (ie: slug or partial permalink) for things. Things being anything that might be part of a permalink (page/post slugs, tags, categories, post types etc etc)

The permalink processor may be thinking you are looking for custom post type 'oliver' and then not finding a specific post called 'about-2' for that post type?

If it is at all possible, try to have the 'slugs' be different at least (Page Title does not matter) .

To test if that is the problem change the page slug to eg: 'oliver_page' . If it then works, then you know you cannot use same slug as post type name. (Or have to change post type slug).

If you REALLY want them to be the same, you may have to come up with some funky permalink / rewrite rules so that there is NO confusion or duplicate possibity about the page required. I've never tried that myself, but it may work.

[Aside: be wary of doing anything that relies on capitals or not - your db collation may be case insensitive - many are, but sometimes wp 'caches' data and that may be case sensitive and if you somehow end up using a capital then not....some functions will work, some not. for example see http://core.trac.wordpress.org/ticket/18210]

share|improve this answer
add comment

As anmari said, don't use the same slug for your pages as you did for your custom post type. This will interfere with the generated rewrite rules.

It's probably a rewrite problem. Use the Monkeyman Rewrite Analyzer from Jan Fabry to debug your rewrite rules. And try to flush the rewrite rules with flush_rewrite_rules() every time you change something.

And put your with_front parameter inside the rewrite parameter:

array {
    // ...
    'rewrite' => array('slug' => 'shrike', 'with_front' => false)
}
share|improve this answer
add comment

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.