Skip to content

Edit Locking & Protection

WB Member Wiki includes two mechanisms to prevent conflicts and protect important content: edit locking for real-time collaboration safety, and page protection for administrative content control.

Edit locking prevents two users from editing the same page simultaneously, avoiding conflicting changes that could result in lost work.

  1. When a user opens a page for editing, the plugin creates a soft lock using WordPress transients
  2. The lock records the user ID and timestamp
  3. While the lock is active, other users see a warning that the page is being edited
  4. The lock auto-refreshes every 30 seconds via a heartbeat AJAX call
  5. The lock expires after the configured duration if the heartbeat stops (e.g., user closes the tab)

Configure the lock duration in WB Plugins > Member Wiki > General:

General Settings - Edit Locking

  • Default: 120 seconds (2 minutes)
  • Range: 30 to 600 seconds
  • The lock refreshes automatically while the editor is open

If a user’s browser closes or loses connection, the lock expires after the configured duration, allowing others to edit the page.

Beyond locking, the plugin detects conflicts when saving:

  1. The editor records when the user started editing (started_at timestamp)
  2. On save, the plugin compares this to the page’s post_modified_gmt
  3. If the page was modified after the user started editing, a conflict warning appears
  4. The user can choose to force save (overwrite) or review the changes first

Edit locking can be toggled in General Settings:

  • Enable Edit Lock - Turn the locking system on or off
  • When disabled, multiple users can edit simultaneously (last save wins)

Page protection locks a page so only administrators can edit it. This is useful for important reference pages, policies, or community guidelines that should not be modified by regular contributors.

Users with the protect role permission can protect a page:

  1. Navigate to the wiki page you want to protect
  2. Click the Protect action link
  3. Confirm the protection

The page is now locked to admin-only editing. A protection indicator appears on the page.

To allow regular editing again:

  1. Navigate to the protected wiki page
  2. Click the Unprotect action link
  3. Confirm the change

Protection requires the protect role permission, configured in WB Plugins > Member Wiki > Permissions. By default, only administrators can protect pages.

User Role Protected Page Unprotected Page
Administrator Can edit Can edit
Editor (wiki role) Cannot edit Can edit
Author (own page) Cannot edit Can edit own page
Contributor Cannot edit Cannot edit (no edit-others permission)

Page protection is stored as a post meta value:

  • Meta key: _wbmw_protected
  • Meta value: true (when protected)
  • When unprotected, the meta is deleted entirely

Protection is checked at the beginning of every edit permission check. If a page is protected, only users with the manage_options capability (administrators) can edit it, regardless of other role settings.

  • Protect finalized content - Lock pages that serve as official references or policies
  • Use edit locking for active collaboration - Keep it enabled when multiple users contribute regularly
  • Set reasonable lock durations - 2 minutes is usually enough; increase for complex pages that take longer to edit
  • Communicate protection - Let your community know why certain pages are protected and how to request changes