WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I created a meta box on the post, page and project post types. The meta boxes save their data well on every post type. However I have a slight problem, when I create a new post and just enter a value in the meta box, then click 'save draft', the value in the meta box is not saved. On the pages and project post types the value would save.

The behaviour is that if I don't enter anything in the title or the content of a new post, no metadata will be saved, and I also noticed that no permalink is generated, while for the other post types it is generated and the meta data is saved.

Is this standard WordPress behaviour or do I have some bug in my code? Functionally wise I don't think it's a big problem, because we will of course always be entering a title and content within the posts, but I'm curious about this behaviour and would like to know if it's coming from my end or not. Thanks.

share|improve this question
Can we see the function that saves your meta data please? – Jared Jan 24 '12 at 14:12
up vote 1 down vote accepted

It's default WordPress behavior. You cannot create, save or even trash "empty" posts (considering, for that last case, that you created one manually).

Luckily, there's a filter that allows you to override it and insert / save posts without need for title or content; insert this into your functions.php:

add_filter('wp_insert_post_empty_content', '__return_false');

I've successfully created a post with only meta fields with the code above.

share|improve this answer
Thanks just what I needed! – drtanz Jan 24 '12 at 19:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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