search ]

How to Share a Draft Post with Anonymous Users in WordPress

Not infrequently, I found myself in a situation where I wanted to share a post or page that was still in draft mode with someone who is not registered in the system.

For example, when someone wrote a guest post on the blog and I wanted to share the final version of the post before publishing, or for example, when I added a language to a specific site and before publishing, I wanted someone without access to the WordPress admin interface to review the translated page.

A quick search led me to the Public Post Preview plugin, which allows sharing a link with anonymous users so that they can view a preview of a draft, post, or any Custom Post Type (CPT) for review before it is published, and this is when they have no access to the WordPress management system.

How to Use the Public Post Preview Plugin

Using the Public Post Preview plugin is very simple:

  • Install and activate the plugin.
  • To enable sharing of a preview, simply check the checkbox under the “Preview” button in the post/page editor.
  • The link will be displayed to you; simply copy it and share it with whoever you want.
  • To disable the preview, simply uncheck the box.

Here’s how it looks in the classic WordPress editor:

Sharing a draft post with an anonymous user in the classic WordPress editor

And here’s how it looks in Gutenberg (WordPress 5.0+):

Sharing a draft post with an anonymous user in Gutenberg

The link will be available for only 48 hours, after which a new link is automatically generated. If you want the link to be active for more than 48 hours, you can use the following filter:

add_filter( 'ppp_nonce_life', 'my_nonce_life' );
function my_nonce_life() {
    return 60 * 60 * 24 * 5; // 5 days
}

After adding this code, the links generated will be available for 5 days. Of course, you can increase this value in the code itself.

Roee Yossef
Roee Yossef

I develop pixel-perfect custom WordPress themes, delivering high-performance, SEO-optimized websites. Have a project in mind? need assistance? Feel free to contact me!

0 Comments...

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!