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.

Am I declaring my custom post types incorrectly?

My permalinks are only working intermittently on my site.

I believe I have my server set up correctly; I have a few Drupal installs up along with my Wordpress install and their clean urls / htaccess rules are working fine.

I've also tried disabling all plugins but that had no effect.

What could I be missing?

Thanks in advance.

function five_oh_one_customizations_custom_post_types(){
$homepage_args = array(
    'public' => true,
    'supports' => array(
        'title', 'editor', 'thumbnail', 'custom_fields', 'revisions'
    ),
    'labels' => array(
        'name' => 'Homepages',
        'singular_name' => 'Homepage',
        'add_new' => 'Add new Homepage',
        'add_new_item' => 'Add new Homepage',
        'edit_item' => 'Edit Homepage',
        'new_item' => 'New Homepage',
        'view_item' => 'View Homepage',
        'not_found' => 'No Homempages found',
        'not_found_in_trash' => 'No Homepagess found in trash'
    ),
    'hiearchial' => false,
    'rewrite' => array(
        'with_front' => false,
        'slug' => '/',
        'feeds' => false,
        'pages' => false
    ),
    'has_archive' => false,
    'query_var' => 'homepage',
    'show_in_nav_menus' => false,
    'menu_position' => 2);

$grantee_args = array(
    'public' => true,
    'supports' => array(
        'title', 'editor', 'thumbnail', 'custom_fields', 'revisions'
    ),
    'labels' => array(
        'name' => 'Grantees',
        'singular_name' => 'Grantee',
        'add_new' => 'Add new Grantee',
        'add_new_item' => 'Add new Grantee',
        'edit_item' => 'Edit Grantee',
        'new_item' => 'New Grantee',
        'view_item' => 'View Grantee',
        'search_item' => 'Search Grantees',
        'not_found' => 'No Grantees found',
        'not_found_in_trash' => 'No Grantees found in trash'
    ),
    'capability_type' => 'post',
    'hiearchial' => false,
    'rewrite' => array(
        'slug' => 'grantee',
    ),
    'has_archive' => true,
    'show_in_nav_menus' => false,
    'query_var' => 'grantee',
    'menu_position' => 3
);

$grantee_project_args = array(
    'public' => true,
    'supports' => array(
        'title', 'editor', 'thumbnail', 'custom_fields', 'revisions'
    ),
    'labels' => array(
        'name' => 'Grantee Projects',
        'singular_name' => 'Grantee Project',
        'add_new' => 'Add new Grantee Project',
        'add_new_item' => 'Add new Grantee Project',
        'edit_item' => 'Edit Grantee Project',
        'new_item' => 'New Grantee Project',
        'view_item' => 'View Grantee Project',
        'search_item' => 'Search Grantee Projects',
        'not_found' => 'No Grantee Projects found',
        'not_found_in_trash' => 'No Grantee Projects found in trash'
    ),
    'capability_type' => 'post',
    'hiearchial' => false,
    'rewrite' => array(
        'slug' => 'grantee-project'
    ),
    'has_archive' => true,
    'show_in_nav_menus' => false,
    'query_var' => 'grantee_project',
    'menu_position' => 4
);

//create custom content types - we'll add the custom fields manually in the ui with the Advanced Custom Fields plugin
//http://www.advancedcustomfields.com/docs/getting-started/ 
register_post_type('homepage', $homepage_args);
register_post_type('grantee', $grantee_args);
register_post_type('grantee_project', $grantee_project_args);

//create custom taxonomy for grantee project content type   
$taxonomy_args = array(
    'public' => true,
    'show_ui' => true,
    'hierarchical' => true,
    'query_var' => 'grantee_project_taxonomy',
    'rewrite' => false,
    'show_tagcloud' => false,
    'show_in_nav_menus' => false,
    'capabilities' => array(
        'manage_terms' => 'do_not_alllow',
        'edit_terms' => 'do_not_allow',
        'delete_terms' => 'do_not_allow',
        'assign_terms' => 'edit_posts'
    ),
    'labels' => array(
        'name' => 'Investment Categories',
        'singular_name' => 'Investment Category',
        'all_items' => 'All Categories',
        'parent_item' => 'Parent Category',
    )
);

register_taxonomy('grantee_project_categories', array('grantee_project'), $taxonomy_args);
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Your rewrite slug is set to '/' - that's going to be a problem. It needs to be a valid string. By default it's going to be 'homepage', the name of the custom post type, but this is where you can change it to something else (e.g. 'homepages') if you're shooting for a specific URL structure.

share|improve this answer
    
That's it! Thanks so much. –  Tim76 Jun 22 '12 at 21:00

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.