I've built a WooCommerce plugin with a particular feature that stopped working right after I upgraded WordPress from 3.8 to 4.1 and WooCommerce from 1 to 2.2. I had added the dg_order post type, which is similar to the WooCommerce shop_order and shares statuses (processing, completed, etc.). My problem is on the admin table for the posts. Right now, the status views at the top of the table read "All (14) | Completed (14)". However, I see "No DG Orders found" under All. Completed does show the orders appropriately. Here's the post type definition:
function dm_inv_dg_post_type () {
$show_in_menu = current_user_can( 'manage_woocommerce' ) ? 'woocommerce' : true;
register_post_type( "dg_order", array(
'labels' => array(
'name' => __( 'DG Orders', 'woocommerce' ),
'singular_name' => __( 'DG Order', 'woocommerce' ),
'add_new' => __( 'Add Order', 'woocommerce' ),
'add_new_item' => __( 'Add New DG Order', 'woocommerce' ),
'edit' => __( 'Edit', 'woocommerce' ),
'edit_item' => __( 'Edit Order', 'woocommerce' ),
'new_item' => __( 'New DG Order', 'woocommerce' ),
'view' => __( 'View Order', 'woocommerce' ),
'view_item' => __( 'View Order', 'woocommerce' ),
'search_items' => __( 'Search DG Orders', 'woocommerce' ),
'not_found' => __( 'No DG Orders found', 'woocommerce' ),
'not_found_in_trash' => __( 'No DG Orders found in trash', 'woocommerce' ),
'parent' => __( 'Parent Orders', 'woocommerce' ),
'menu_name' => _x('DG Orders', 'Admin menu name', 'woocommerce')
),
'description' => __( 'This is where orders to DG are stored.', 'woocommerce' ),
'public' => false,
'show_ui' => true,
'capability_type' => 'shop_order',
'map_meta_cap' => true,
'publicly_queryable' => false,
'exclude_from_search' => true,
'show_in_menu' => $show_in_menu,
'hierarchical' => false,
'show_in_nav_menus' => false,
'rewrite' => false,
'query_var' => false,
'supports' => array( 'title', 'comments' ),
'has_archive' => false,
)
);
}
add_action('init', 'dm_inv_dg_post_type', 12);
The WooCommerce upgrade changed how the statuses are stored (as an actual post status instead of taxonomy terms), so that likely has something to do with it. I thought it might have something to do with the show_in_admin_all_list
parameter for register_post_status
, but the WooCommerce developers set that to true
, and the correct number of completed orders show up in the All count.
Any thoughts?