0

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);
}
0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.