WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#42508 closed defect (bug) (worksforme)

Added new entry without submitting post data.

Reported by: amit_ratio Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:
PR Number:

Description

Hello Team,

I have just found a weird thing with WordPress. I am not sure whether it is a bug/feature. However, I find it annoying. So, here is what I noticed:

Whenever, I click on "Add New" of post a new entry has been added to the database under 'wp_post' field. I find it annoying because it is making empty entries to the table. There must be some check whether post have something to save or not so, that false entries will be prevented.

Change History (3)

#1 follow-up: @swissspidy
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Hey there,

This is intended behaviour. WordPress creates auto-draft entries in the database. These auto-drafts are periodically deleted by WordPress, so your database definitely won't be cluttered with hundreds of auto-drafts.

If you want to disable auto-drafts, you need to completely disable revisions, e.g. using define('WP_POST_REVISIONS', false );

#2 in reply to: ↑ 1 @amit_ratio
2 years ago

Replying to swissspidy:

Hey there,

This is intended behaviour. WordPress creates auto-draft entries in the database. These auto-drafts are periodically deleted by WordPress, so your database definitely won't be cluttered with hundreds of auto-drafts.

If you want to disable auto-drafts, you need to completely disable revisions, e.g. using define('WP_POST_REVISIONS', false );

Thank You, for clarification :) .

#3 @johnbillion
2 years ago

  • Version 4.9 deleted

Background: the reason for this is to standardise the behaviour when saving posts.

The intention is for there to always be a valid post ID available at the point where a post is saved, so plugins and anything else which hooks into actions and filters doesn't need to worry about differing behaviour when saving "new" posts vs updating existing posts.

Note: See TracTickets for help on using tickets.