# Draft and Publishing Workflow The **draft and publishing workflow** is the set of post/page statuses — Draft, Pending Review, Private, Password protected, Published — that content moves through from creation to visibility, plus the editorial roles that manage each step. ## Why it matters The workflow enforces editorial control and least-privilege: contributors write drafts they cannot publish, editors review and publish, and sensitive content can stay Private or password-protected. Understanding statuses prevents accidental early publication, keeps unreviewed content out of search engines, and supports multi-author governance where a mistaken click could otherwise expose confidential material or leak an embargoed announcement. Because a post's status directly controls who can read it, treating status as a security boundary — not just an editorial convenience — is essential. A `draft` or `pending` post is not indexed and returns a 404 to anonymous visitors, while `private` restricts reading to users with the `read_private_posts` capability. ## How it works WordPress stores the status in the `post_status` column of the `wp_posts` table. Core statuses and their visibility: - **Draft** (`draft`) — saved but not public; the default for new, unpublished content. Also produces auto-saved **revisions**. - **Pending Review** (`pending`) — a Contributor submits for an Editor/Admin to approve and publish. - **Private** (`private`) — published but visible only to logged-in Editors/Admins with the right capability. - **Password protected** — status is `publish` but a per-post password gates the content body via the `post_password` field. - **Scheduled** (`future`) — set to go live automatically at a chosen date via WP-Cron. - **Published** (`publish`) — live to everyone. Role tie-in follows the capability model: a **Contributor** can `edit_posts` but not `publish_posts`; an **Author** has `publish_posts` for their own content; an **Editor** has `edit_others_posts` and `publish_pages`, so they publish/edit any post. ![WordPress editor Status & visibility panel showing Draft, Pending review, and Publish options](images/wordpress-status-visibility-panel.png) > [!TIP] > Set a post to **Pending Review** rather than emailing an editor. It creates a clear, queryable queue (`post_status=pending`) that editors can filter in the admin list table under Posts. ## Example ```bash # List posts awaiting review, then publish one after approval (WP-CLI) wp post list --post_status=pending --fields=ID,post_title,post_author # Move a pending post to published after review wp post update 143 --post_status=publish # Send a published post back to draft (unpublishes it) wp post update 143 --post_status=draft # Publish as Private (only logged-in editors/admins can read) wp post update 143 --post_status=private ``` Setting a password protects the body while leaving the post publicly listed: ```sql -- Inspect status and password directly (read-only check) SELECT ID, post_title, post_status, post_password FROM wp_posts WHERE post_type = 'post' AND post_status IN ('draft','pending','private'); ``` ## Security considerations - **Draft ≠ secret.** Anyone who can guess the post ID or preview URL, plus any user with `edit_posts` on the site, may reach a draft. Do not store credentials or unredacted PII in draft bodies. - **Preview links** use a nonce (`preview_nonce`); do not share raw preview URLs externally, as authenticated previews can expose unpublished content. - **Least privilege:** keep publishing capabilities scoped. Grant Contributor (no publish) by default and promote to Author/Editor deliberately. Audit with `wp user list --field=user_login --role=editor`. - **Password-protected posts** transmit the password in a cookie; always serve the site over HTTPS so it is not exposed in transit. - **REST API exposure:** the `/wp-json/wp/v2/posts` endpoint honours status permissions, but misconfigured custom post types can leak drafts. Verify `show_in_rest` and capability mappings for any custom type. > [!WARNING] > Reverting a `publish` post to `draft` removes it from the front end and search results, but cached copies (CDN, browser, search-engine cache) may persist. For truly sensitive removals, also purge caches and, if needed, request search-engine removal. ## Troubleshooting - **Scheduled post shows "Missed schedule".** WP-Cron did not fire because the site had no traffic at the scheduled time. Trigger cron manually or move to a real system cron: ```bash wp cron event run --due-now ``` ```conf # Disable pseudo-cron and drive it from the OS (wp-config.php) define('DISABLE_WP_CRON', true); # crontab: run every 5 minutes */5 * * * * wp --path=/var/www/html cron event run --due-now >/dev/null 2>&1 ``` - **Contributor cannot publish.** Expected — that is by design. Confirm the role with `wp user get --field=roles`; if publishing is intended, use the Author role, not a custom capability hack. - **Post stuck in Pending.** Check the assigned author still exists and that an Editor account is available to approve it. ## References - Post Status — https://wordpress.org/documentation/article/post-status/ - Roles and Capabilities — https://wordpress.org/documentation/article/roles-and-capabilities/ - WP-CLI `wp post` command — https://developer.wordpress.org/cli/commands/post/ - Content Visibility (password/private) — https://wordpress.org/documentation/article/content-visibility/ - Function reference `wp_insert_post()` statuses — https://developer.wordpress.org/reference/functions/wp_insert_post/ ## Related - [Posts & Pages Management](Readme.md) — module MOC - [Creating-Blog-Posts](Creating-Blog-Posts.md) - [Scheduling-Posts](Scheduling-Posts.md) - [Secure WordPress Administration](../Readme.md) — course MOC