This one is doing my head in! I’m using this code as the basis for one of my custom post types.
In my case I don’t need the editor – I just want the user to complete the contents within the meta box.
When I adjust this line:
'supports' => array( 'title', 'editor', 'thumbnail' ),
to this instead
'supports' => array( 'title', 'thumbnail' ),
Everything works – except that for the fact that if I leave the page open and unedited for a short period of time I get the alert box prompting me that unsaved changes will not be saved. There are no changes being made to the post! Simply adding back in the ‘editor’ support fixes the issue but I don’t want the editor.
I’ve also tried adding
remove_post_type_support( 'mycustompost_type', 'editor' );
Just after the register_post_type call but the same issue persists.
I’ve read multiple threads about AUTOSAVE etc. which are all present in the generic functions file that comes with this code https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/blob/master/functions/meta_box.php
Has anyone any experience with this issue and how to resolve?
The auto-save that is running is searching for a field with name=”post_content”. I believe a quick fix to you’re problem would be to add a hidden field like this:
This might allow the auto-save to function by simply inserting an empty string for the post_content field of wp_posts table.
I have not had this issue before. But please try this out and tell me if it works for you.