Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Closed 6 years ago.
Improve this questionAt some point this morning I realised that all of my custom posts of one type ('resources'), have disappeared from admin, the section is still there yet says 'no posts found'. Another type, 'contacts' remain. Yet my 'resources' still appear on their page as if they're in the database.
The custom fields I had created for each post type were still in the AFC admin section but were no longer linked to resources (although they were still linked to contacts).
I have tried undoing what I've done so far today but I can't seem to locate the issue! Any thoughts/suggestions on how I can retrieve them?!
I have a mu-plugin for registering my post types, maybe there's something I've missed here:
function register_post_types() {
register_post_type('contact', array(
'public' => true,
'menu_icon' => 'dashicons-admin-users',
'supports' => array(
'title',
'editor',
'excerpt',
'page-attributes',
'custom-fields'),
'labels' => array(
'name' => 'Contacts',
'add_new_item' => 'Add New Contact',
'edit_item' => 'Edit Contact',
'all_items' => 'All Contacts',
'singular_name' => 'Contact'
)
));
...
register_post_type('resources', array(
'public' => true,
'taxonomies' => array(
'category'),
'supports' => array(
'title',
'editor',
'excerpt',
'page-attributes',
'custom-fields'),
'labels' => array(
'name' => 'Resources',
'add_new_item' => 'Add New Resource',
'edit_item' => 'Edit Resource',
'all_items' => 'All Resources',
'singular_name' => 'Resource')
));
}
Thanks in advance!
Closed. This question is off-topic. It is not currently accepting answers.Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Closed 6 years ago.
Improve this questionAt some point this morning I realised that all of my custom posts of one type ('resources'), have disappeared from admin, the section is still there yet says 'no posts found'. Another type, 'contacts' remain. Yet my 'resources' still appear on their page as if they're in the database.
The custom fields I had created for each post type were still in the AFC admin section but were no longer linked to resources (although they were still linked to contacts).
I have tried undoing what I've done so far today but I can't seem to locate the issue! Any thoughts/suggestions on how I can retrieve them?!
I have a mu-plugin for registering my post types, maybe there's something I've missed here:
function register_post_types() {
register_post_type('contact', array(
'public' => true,
'menu_icon' => 'dashicons-admin-users',
'supports' => array(
'title',
'editor',
'excerpt',
'page-attributes',
'custom-fields'),
'labels' => array(
'name' => 'Contacts',
'add_new_item' => 'Add New Contact',
'edit_item' => 'Edit Contact',
'all_items' => 'All Contacts',
'singular_name' => 'Contact'
)
));
...
register_post_type('resources', array(
'public' => true,
'taxonomies' => array(
'category'),
'supports' => array(
'title',
'editor',
'excerpt',
'page-attributes',
'custom-fields'),
'labels' => array(
'name' => 'Resources',
'add_new_item' => 'Add New Resource',
'edit_item' => 'Edit Resource',
'all_items' => 'All Resources',
'singular_name' => 'Resource')
));
}
Thanks in advance!
Share Improve this question asked Mar 27, 2019 at 12:08 JakePowellJakePowell 431 silver badge10 bronze badges1 Answer
Reset to default 1Solved! For some reason I had changed the name of my custom post type slightly, in my register_custom_post_types.php file
register_post_type('programmes', array(
I changed the name back and they reappeared...
I've learnt to keep in mind how changes to things can affect WP's ability to retrieve data
Edit: On further investigation it appears that the custom post type names became invalid because they were changed after the 'init' action, so stopping the virtual machine and restarting actually would have resolved the problem too