Hide Published Content for Internal Review

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.

Leave a Reply

Posted in php
katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.