Same posts displaying in admin screen for all defined custom post types
-
I have created two custom post types, one called ‘my_product’ and one ‘my_homepage_item’. I created the first, made a number of product items, then created the homepage items category. Hitting “add item” successfully allows me to write a homepage item to the database, but when I view the custom post category in the admin menu, it is showing me the list of products. I cannot access the homepage item post types anywhere, as all admin pages other than the add-new page will only display content for the original products category. Has anybody else experienced this issue? I created a third post type, but it too only displays posts from the original product type.
Post type definition code:
function create_nti_product() { register_post_type( 'my_product', array( 'labels' => array( 'name' => __( 'Products' ), 'singular_name' => __( 'Product' ), 'add_new' => __( 'Add New' ), 'add_new_item' => __( 'Add Product' ), 'edit' => __( 'Edit' ), 'edit_item' => __( 'Edit Product' ), 'new_item' => __( 'New Product' ), 'view' => __( 'View Product' ), 'view_item' => __( 'View Product' ), 'search_items' => __( 'Search Products' ), 'not_found' => __( 'No products found' ), 'not_found_in_trash' => __( 'No products found in Trash' ), ), 'public' => true, 'show_ui' => true, 'menu_position' => 21, 'can_export' => true, /* Allow you to export the video items through the WP Export tool */ 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' ), ) ); register_post_type( 'my_homepage_item', array( 'labels' => array( 'name' => __( 'Homepage Items' ), 'singular_name' => __( 'Homepage Item' ), 'add_new' => __( 'Add New Homepage Item' ), 'add_new_item' => __( 'Add Homepage Item' ), 'edit' => __( 'Edit' ), 'edit_item' => __( 'Edit Homepage Item' ), 'new_item' => __( 'New Homepage Item' ), 'view' => __( 'View Homepage Item' ), 'view_item' => __( 'View Homepage Item' ), 'search_items' => __( 'Search Homepage Items' ), 'not_found' => __( 'No Homepage Items found' ), 'not_found_in_trash' => __( 'No Homepage Items found in Trash' ) ), 'public' => true, 'show_ui' => true, 'can_export' => true, /* Allow you to export the video items through the WP Export tool */ 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' ), ) ); // OK, what if we create a new one? register_post_type('whatiswrong',array('labels' => array('name' => 'Wrong!'),'public' => true));
- The topic ‘Same posts displaying in admin screen for all defined custom post types’ is closed to new replies.