June 02, 2021
Working on new layouts on a live site? Client unfamiliar with WordPress and how to login and view Draft pages?
Use this in your header file to generate private content links for review.
if($post->ID == 2993 ) { // change to your page id
if(!isset($_GET['review'])) // can be changed to a specific word or phrase without spaces
{
wp_redirect(get_bloginfo('url'));
}
}
Access the page using the keyword at the end of the url:
https://yoururl.com/page-slug/?review=true
Anyone accessing the url without the keyword=true at the end of the url will be unable to view the content, and will be redirected back to the home page.