Home » How To Allow Preview Of Draft Post Without Login In WordPress

How To Allow Preview Of Draft Post Without Login In WordPress

Last updated on December 27, 2020 by

Table of Contents
1. Share Draft Posts With Someone in WordPress
2. How To Test This Without Sharing Links To Someone By Yourself?
3. Additional Information About The Public Post Preview Plugin
3.1 Life of Shared Link
3.2 Increase or Decrease Shared Link Life

In WordPress, You can’t share your draft post with someone to view without login but what if you wanted to do that? You can create someone’s account in WordPress and assign some permissions to allow preview of your draft posts, but what if you wanted to just share the links without creating an account? In this article, we will show you how to easily allow preview of a draft post to someone without login in WordPress. We hope you like it.

Share Draft Posts With Someone in WordPress

  1. Go to the Plugins main menu and click on ‘Add New’ submenu in your WordPress admin area.
  2. Search for Public Post Preview and Click on the "Install Now" button and then click to activate the plugin or you can download manually, install and activate it.
public post preview of unpublished posts
  1. Now, go to edit the post or page that you want to share. Under the Document tab in Gutenberg or under the publish meta box in Classic Editor, you will see the new checkbox to enable public preview of the post or page.
public post preview of unpublished posts
  1. After enabling the public preview, you need to click on the save draft button to save your changes. Next, you can copy the public preview URL and share it with the person you want. That’s it.

How To Test This Without Sharing Links To Someone By Yourself?

  1. First of all, try to access your drafts posts or pages without login into WordPress with your browser’s private window or incognito window. It won’t let you do it and throw a 404 page not found.
  2. Now, enable public preview checkbox in any of your draft’s posts and copy the public preview URL and try to access in browser’s private window or incognito window without login into WordPress. It will start showing you the draft post. Hurray!

Additional Information About The Public Post Preview Plugin

The Public Post Preview plugin generates an URL with an expiring NONCE appended to its end. For example, "&preview=1&_ppp=36c91f4a5e". This appended part can be very based on plugin’s version.

Shared links will live up to 48 hours by default. This has been tested in plugin’s Version: 2.9.0.

The shared link will be expired after 48 hours then the plugin will generate a new automatic link in the same post or page. You need to copy again if you want to share it again after 48 hours.

You can increase or decrease shared link life’s via following code snippet. Please note that plugin provides filter hook ppp_nonce_life to do the job but they can keep or remove this feature in future plugin updates.

<?php

if ( !function_exists ('sc_ppp_nonce_life') ) :

	add_filter( 'ppp_nonce_life', 'sc_ppp_nonce_life' );

	function sc_ppp_nonce_life() {
	    return 60 * 60 * 2; // 2 hours
	}

endif;

That’s it. We hope this article helped you to learn how to allow preview of draft post without login in WordPress

Please let us know in the comments if everything worked as expected, your issues, or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading this post 🙂 Keep Smiling! Happy Coding!

 
 

1 thought on “How To Allow Preview Of Draft Post Without Login In WordPress”

Leave a Comment