Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've registered several custom post type using a custom plugin. All of them seems to work fine. All are listed under the Post Menu.

The problem occurs when I saved a custom post entry. The custom post type is saved on the database, and the permalink works fine from the front end. But strangely, the custom post type table is empty. The post status filter, shows ' All (1) | Published (1) '. Screenshot

After some investigation, I found out that this happens after the second register_post_type() is called in my custom plugin.

How can i fix this problem?

Thank you.

Added

Here is 2 of the register_post_type code. Each of them are called from a different file using include_once ('product/product.php'); and include_once ('order/order.php');

add_action('init', 'product_post_type', 0 );

function product_post_type() {

$product_labels = array(
    'name' => _x('Product', 'post type general name'),
    'singular_name' => _x('Product', 'post type singular name'),
    'add_new' => _x('Add New', 'investment'),
    'add_new_item' => __('Add New Product'),
    'edit_item' => __('Edit Product'),
    'new_item' => __('New Product'),
    'view_item' => __('View Product'),
    'search_items' => __('Search Product'),
    'not_found' =>  __('No product found'),
    'not_found_in_trash' => __('No product found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => 'Product'
);
$product_args = array(
    'labels' => $product_labels,
    'public' => true,
    'can_export' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'product' ),
    'capability_type' => 'post',
    'map_meta_cap' => true,
    'has_archive' => true, 
    'hierarchical' => true,
    'menu_position' => 6,
    'show_in_nav_menus' => false,
    'supports' => array('title','editor','thumbnail','comments')
); 

register_post_type('product',$product_args);

}


add_action('init', 'order_post_type', 0 );

function order_post_type() {

$order_labels = array(
    'name' => _x('Order', 'post type general name'),
    'singular_name' => _x('Order', 'post type singular name'),
    'add_new' => _x('Add New', 'investment'),
    'add_new_item' => __('Add New Order'),
    'edit_item' => __('Edit Order'),
    'new_item' => __('New Order'),
    'view_item' => __('View Order'),
    'search_items' => __('Search Order'),
    'not_found' =>  __('No order found'),
    'not_found_in_trash' => __('No order found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => 'Order'
);
$order_args = array(
    'labels' => $order_labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => true,
    'menu_position' => 8,
    'supports' => array('title')


); 

register_post_type('order',$order_args);

}
share|improve this question
    
show us the code you are using to register your custom post types –  Milo Oct 17 '12 at 4:12
    
done that @Milo –  ifdion Oct 17 '12 at 4:28
add comment

1 Answer

up vote 0 down vote accepted

Some words used as names for post types will produce unpredictable results, in your case, the word order is a reserved term and is causing problems with the query. Change that post type name to something unique and the admin UI will behave.

share|improve this answer
    
Thank you @milo. Totally forgot about that. –  ifdion Oct 17 '12 at 4:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.