Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Post Locking

Intro

As of WordPress 3.6, a new post locking feature was implemented thanks to the new Heartbeat API (also added in 3.6).

History

In previous versions of WordPress, any user could open a post currently being edited by another user, with only a warning displayed:

post-edit-warning-message-3.5.png

Warning displayed in versions of WordPress earlier than 3.6

Workflow

As of 3.6, posts are locked during editing, preventing other users from accessing and modifying the post.

post-listing-lock.png

The posts listing, showing a locked post currently being edited.

If a user clicks to edit a post that's currently locked they are presented with three options in a pop-up dialog:

  1. Go Back - Return to the 'Posts' listing.
  2. Preview - Preview the current state of the post that's being edited.
  3. Take Over - Lock out the current editor of the post and begin editing. (The other user will receive a notification)

take-over-dialog.png

The "Take Over post editing" dialog

The user that has been locked out receives the following dialog, and is no longer able to edit the post.

locked-out-post.png

Dialog received by current editor when another user selects to "Take Over"

As the Heartbeat API sends requests every 15 seconds, it can take up to 15 seconds for the current post editor to be notified that another user has taken over.

This article is marked as in need of editing. You can help Codex by editing it.