How to Hide WordPress Protected Content

Once your private content is protected by our Protect Pages & Posts (PPP) plugin, those without permission won’t be able to access the content directly through its URL. They will be redirected to your “No Access” page instead. 

However, the protected content will still display somewhere on your website such as your home page latest posts, Archives and Search results. This accidentally reveals your private content to unwanted users. That’s why we’ve developed a new feature which allows you to control the visibility of your protected pages and posts. In other words, you’ll be able to hide or decide where to display the protected content.


When a post is protected, it will no longer show up on these places by default:

  • Front page latest posts
  • Category pages
  • Author pages
  • Archives
  • Recent posts
  • Search results
  • RSS Feeds
  • Next & Previous on a single page or post
  • Latest Posts, Recent Comments & Comments RSS Guttenberg widgets (WIP)

When it comes to WordPress protected pages, they will be excluded from:

  • Front (home) page
  • Search results
  • Anywhere else it is listed via get_pages function

If you’re using the popular Yoast SEO plugin with the XML sitemaps enabled, we will provide another option to help you exclude your protected pages and posts from the XML sitemaps. As a result, they won’t be indexed by Google and other search engines anymore. 

Compatible with Flatsome theme

Flatsome theme uses a different method from WordPress to list the content in blog post. That’s why your content might still display even when it’s already protected with PPP plugin.

To hide your private content built by Flatsome, add the following code snippet to your (child) theme’s functions.php file.

You can find the blog post’s ID by hovering over its title.

	function ( $posts ) {
		if ( ! method_exists( 'Prevent_Page_Pup_Function_Gold', 'ppp_get_protected_ids_by_protected_posts' ) ) {
			return $posts;
		if ( ! is_singular() ) {
			return $posts;
		$post_id            = get_the_ID();
		$whitelisted_post_id = [ your-blog-post-id];
		if ( ! in_array( $post_id, $whitelisted_post_id ) ) {
			return $posts;
		$function      = new Prevent_Page_Pup_Function_Gold();
		$protected_ids = $function->ppp_get_protected_ids_by_protected_posts();
		if ( ! $protected_ids ) {
			return $posts;
		$posts = array_filter(
			function ( $post ) use ( $protected_ids ) {
				return ! in_array( $post->ID, $protected_ids );
		$posts = array_values( $posts );
		return $posts;
Lasted updated on February 26, 2021