Sorry, I’m not a developer, just doing my best by trying to understand it all.
I am registering the CPT in my own code because the use of plugins wasn’t getting me where I wanted.
This is the full contents of my funcions.php in my child theme where I declare the CPT and its categories. Maybe you can spot what is wrong with this because the url for case-studies still has /blog in front of it. Thanks for any help!
/*Custom Post type start*/
function cw_post_type_casestudies() {
$supports = array(
'title', // post title
'editor', // post content
'author', // post author
'thumbnail', // featured images
'excerpt', // post excerpt
'custom-fields', // custom fields
'comments', // post comments
'revisions', // post revisions
'post-formats', // post formats
);
$labels = array(
'name' => _x('Case Studies', 'plural'),
'singular_name' => _x('Case Study', 'singular'),
'menu_name' => _x('Case Studies', 'admin menu'),
'name_admin_bar' => _x('Case Studies', 'admin bar'),
'add_new' => _x('Add New', 'add new'),
'add_new_item' => __('Add New Case Study'),
'new_item' => __('New Case Study'),
'edit_item' => __('Edit Case Study'),
'view_item' => __('View Case Study'),
'all_items' => __('All Case Studies'),
'search_items' => __('Search Case Studies'),
'not_found' => __('No Case Studies found.'),
);
$args = array(
'supports' => $supports,
'labels' => $labels,
'public' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'case-studies',
'with_front' => true,
'pages' => true,
'feeds' => true,
),
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 4,
'menu_icon' => 'dashicons-id-alt',
);
register_post_type('case-studies', $args);
}
add_action('init', 'cw_post_type_casestudies');
/*Custom Post type end*/
/*Custom categories for Case Studies start*/
function tr_create_my_taxonomy() {
register_taxonomy(
'case-studies-category',
'case-studies',
array(
'label' => __( 'Categories' ),
'rewrite' => array( 'slug' => 'case-studies-category' ),
'hierarchical' => true,
)
);
}
add_action( 'init', 'tr_create_my_taxonomy' );
/*END Custom categories for Case Studies start*/