3

This one is doing my head in! I'm using this code as the basis for one of my custom post types.

https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/blob/master/functions/real-estate.php

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?

1
  • Had you tried it without a plugin? It is hard to guess is it issue with plugin you are using, WP core or something entirely different in your install.
    – Rarst
    Commented Nov 17, 2012 at 20:50

1 Answer 1

1

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:

<input type="hidden" name="post_content" value="" />

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.