I'm getting the following warning in my WP admin custom posts listings page (wp-admin/edit.php?post_type=video
)
Warning: Illegal offset type in isset or empty in wp-includes/post.php on line 817
I'm running WordPress v3.1.3 (latest). Line 817 is in the function get_post_type_object()
. A search finds me these threads:
http://wordpress.org/support/topic/warning-illegal-offset-type-in-isset-or-empty
http://wordpress.org/support/topic/error-when-searching-for-posts-in-the-backend-illegel-offset
These mention some different potential causes - e.g. it might be https://core.trac.wordpress.org/ticket/12704 - but that's now fixed (I'm running v3.1.3) - and the final post in one reads:
Basically, you have a plugin registering a post type incorrectly, and then core complains. It isn't a bug in core best I can tell.
I do have a plugin (my own) registering a post type, but I think it's doing it correctly.
Here's the code. (Note that I was originally calling these "video" posts but later renamed the front-end description to "Training Module", but left the original post-type name).
function video_register() {
$labels = array(
'name' => _x('Modules', 'post type general name'),
'singular_name' => _x('Training Module', 'post type singular name'),
'add_new' => _x('Add New Module', 'video item'),
'add_new_item' => __('Add New Training Module'),
'edit_item' => __('Edit Training Module'),
'new_item' => __('New Training Module'),
'view_item' => __('View Training Module'),
'search_items' => __('Search Training Modules'),
'not_found' => __('No Training Modules found'),
'not_found_in_trash' => __('No Training Modules found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'has_archive' => 'video',
'menu_icon' => 'video16x16.png',
'rewrite' => array('slug'=>'training','with_front'=>false),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => '15',
'supports' => array('title','author','editor','custom-fields','revisions','comments','trackbacks'),
'taxonomies' => array('category', 'post_tag')
);
register_post_type( 'video' , $args );
}
add_action('init', 'video_register');
Is there a problem there? Why am I seeing the warning?
@Jan
when you reply in a comment and I get a notification)