Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a custom post type and for debugging reasons i display the Post ID on the Add New ... page. If i refresh the page without saving or even creating a new post,(so i just press f5 on the post-new.php) the post ID is growing one by one.

Why is this happening and is this the normal behaviour?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

This is normal behaviour, as I understand it.

When you load the page post-new.php, you run this function:

$post = get_default_post_to_edit( $post_type, true );

where the second argument stands for $create_in_db. If true then this part is executed:

if ( $create_in_db ) {
            $post_id = wp_insert_post(...);
}

inside get_default_post_to_edit().

share|improve this answer
    
Thanks, i don't worry about this then, but its still a little strange i think...:) –  passatgt Apr 1 '13 at 11:49
add comment

Your Answer

 
discard

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.