I’m attempting to upgrade a WP install from 4.0.6 to 4.4.2. Most of the update went swimmingly, but I’m faced with a pretty cool error message I can’t seem to figure out:
Warning: Creating default object from empty value in /nas/content/staging/thebaffler/wp-content/themes/baffler/inc/custom-posts.php on line 216
The error seems to be thrown by a theme file that renames the default labels WP uses for the ‘post’ type of content. What’s odd is that all the ‘post’ labels still continue to render with the settings specified in the theme file ‘custom-posts.’
Here’s a snippet of the code in question. 214 is the first line excerpted here. If I comment line 216, the error message refers to 215 instead:
$labels = &$wp_post_types['post']->labels;
$labels->name = 'Blog';
$labels->singular_name = 'Blog';
$labels->add_new = 'Add Blog entry';
$labels->add_new_item = 'Add Blog entry';
$labels->edit_item = 'Edit Blog entry';
$labels->new_item = 'Blog entry';
$labels->view_item = 'View Blog entry';
$labels->search_items = 'Search Blog Entries';
$labels->not_found = 'No Blog entries found';
$labels->not_found_in_trash = 'No Blog entries found in Trash';
$labels->all_items = 'All Blog Entries';
$labels->menu_name = 'Blog';
$labels->name_admin_bar = 'Blog';
Looking in the codex, I don't see any recent changes to wp_post_types
. https://codex.wordpress.org/Function_Reference/get_post_type_object
What should I do next to troubleshoot this error?
Thanks James