The post-draft mechanism is a useful option in WordPress when you want to save any post (for example blog article or e-commerce product) but you don’t want to publish it yet. You can also send the draft URL to someone else but this person must have appropriate access to the wp-admin section to show the content of the draft.
The problem arises when we want to show a draft of a post for people who don’t have any access to our wp-admin panel.
For this purpose, there was created an easy tool – Post Draft Preview. It is a very simple WordPress plugin compatible both with Gutenberg editor and with classic editor TinyMCE. We can use PDP for all types of posts (posts, pages, WooCommerce products, and other custom post types).
After installing it, we can open our draft. If we use Gutenberg, then in the top bar of the editor we’ll see the button “Enable PDP”. This is shown in the picture below:
After clicking the button, the generated public link to the draft will appear. Except that, there is also a button to “Disable PDP” for the current draft of the post.
The feature looks similar in the classic editor:
The link to the public preview of the draft contains inside a random string – generated to only one specific post. We have more control over publishing posts with this property, cause someone who has only one link to the draft will not be able to view the other drafts. Except that we can enable or disable draft preview individually for each post.
The public link to the draft preview is visible also in the admin summary view of posts:
The Post Draft Preview Is protected against accidental plugin disable – all data is stored in the “Post meta” table, so even removing the plugin will not lose the generated links.
An additional feature of this plugin is the possibility to reset all generated links to drafts with one click. We can do it is in Tools -> Post Draft Preview -> Reset links structure.
We should be careful because this option causes existing public drafts links to stop working. However, this step is sometimes necessary for security reasons.
Below are the most important advantages of the Post Draft Preview plugin:
- Lightweight & simplicity;
- Possiblility to activate or deactivate public draft preview for any post indyvidually;
- Security by generating random url for each posts;
- Possibility of mass reset all links;
- Compatibility with Gutenberg and with the Classic Editor;
- Activation only when you need it, without possibility of data loss;