categories won't show custom post types
-
hi, ive added one custom post type called “places”. it works fine, but i wanted to be able to add custom post types to categories, so i followed the instructions here:
https://www.deluxeblogtips.com/2010/07/custom-post-type-with-categories-post.html
which had me add this to my functions.php in the custom post type section:
'taxonomies' => array('category', 'post_tag') // this is IMPORTANT
so my custom post type looks like this:
add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'pn_places', array( 'labels' => array( 'name' => __( 'Places' ), 'singular_name' => __( 'Place' ) ), 'menu_position' => 4, 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'places'), 'taxonomies' => array('category', 'post_tag') // this is IMPORTANT ) ); }
which gives me the ability to select categories to include the custom post type in.
the problem is that when i look at my posts by category:
https://punknomad.com/category/destinations/unusual-monuments/
i get a “no posts found” error. ive been looking around for quite a while and haven’t been able to find anything related specifically to this problem.
does anyone out there know what i can do to solve this? thanks!
- The topic ‘categories won't show custom post types’ is closed to new replies.