0

UPDATE: I just noticed that the issue is happening regardless of the post status(ie Published posts don't show up in the backend or the frontend either, but all posts show up in the database just not in the backend/frontend). I also have a handful of other custom post types and those are all working correctly. This post type was working correctly at one time too, it only started behaving this way and I have not changed anything in regards to the post type code.

UPDATE 2: I've discovered that this only happens with posts which do not have a featured image selected. If I select a featured image they display correctly, but if I don't they disappear from the frontend and backend despite existing in the database. I was able to confirm this by manually adding a row for _thumbnail_id in the post_meta table of the database which caused the post to begin showing up in the backend and frontend again.

The strange thing is, my other custom post types support featured images as well, and they work as expected even if no featured image is associated.

================================

I have a custom post type in my Wordpress install and when I create a new post within that post type and save it as a draft or publish it, the number of posts/drafts in parentheses is incremented, but when I try to view them it says there are none:

enter image description here

I tested the standard Wordpress "Posts" and the posts correctly display there.

Here is my functions.php code to create the custom post type:

function create_products_post_type() {

  register_post_type('product',
    array(
      'labels' => array(
        'name' => __('Products'),
        'singular_name' => __('Product'),
        'menu_name' => __('Products'),
        'name_admin_bar' => __('Product'),
        'add_new' => __('Add New Product'),
        'add_new_item' => __('Add New Product'),
        'new_item' => __('New Product'),
        'edit_item' => __('Edit Product'),
        'view_item' => __('View Product'),
        'all_items' => __('All Products')
      ),
      'public' => true,
      'has_archive' => true,
      'show_in_nav_menus' => true,
      'rewrite' => array('slug' => 'products'),
      'supports' => array('title','thumbnail','page-attributes')
    )
  );

}

add_action('init', 'create_products_post_type');

Any ideas why I can't see my Posts?

Your Answer

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

Browse other questions tagged or ask your own question.