I'm using the CPT UI plugin to create a custom post type with a custom taxonomy. I'm finding however that the individual post page shows "No Results Found".
I'm using this page slug as the CPT custom rewrite slug: wbc-activity-page
The terms page is working correctly on this url: domain.com/wbc-activity-page/home/
The issue is that the post page is showing 'no results found' on the post's url: domain.com/wbc-activity-page/wbc-post-1/
This is my post type settings:
function cptui_register_my_cpts_wbc_activity() {
/**
* Post Type: WBC Activities.
*/
$labels = [
"name" => __( "WBC Activities", "mw-theme" ),
"singular_name" => __( "WBC Activity", "mw-theme" ),
];
$args = [
"label" => __( "WBC Activities", "mw-theme" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => false,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"delete_with_user" => false,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => [ "slug" => "wbc-activity-page", "with_front" => true ],
"query_var" => true,
"supports" => [ "title", "editor", "thumbnail", "custom-fields", "comments", "revisions" ],
"taxonomies" => [ "wbc_category" ],
];
register_post_type( "wbc_activity", $args );
}
add_action( 'init', 'cptui_register_my_cpts_wbc_activity' );
This is my custom taxonomy settings:
function cptui_register_my_taxes_wbc_category() {
/**
* Taxonomy: WBC Activity Categories.
*/
$labels = [
"name" => __( "WBC Activity Categories", "mw-theme" ),
"singular_name" => __( "WBC Activity Category", "mw-theme" ),
];
$args = [
"label" => __( "WBC Activity Categories", "mw-theme" ),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => [ 'slug' => 'wbc-activity-page', 'with_front' => true, ],
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "wbc_category",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => true,
];
register_taxonomy( "wbc_category", [ "wbc_activity" ], $args );
}
add_action( 'init', 'cptui_register_my_taxes_wbc_category' );
Is there something I'm missing here?
wbc-activity-page/wbc-post-1/
, WordPress thinkswbc-post-1
is a taxonomy term, which is why it can't find any posts. They'll need to be different.domain.com/wbc-activity-page/home/
is that for a CPT with the slughome
or a term with the slughome
? You can't have clashes