Hello Guys, today i am going to explain you simple logic on making blog page passport protected.

Step 1: select one of the page as post page. You can select this from dashboard -> setting -> reading -> post page section


step 2: Then you need to find which template is in use to display post page. See here for template heirarchy https://developer.wordpress.org/themes/basics/template-hierarchy/

And add this following condition just before the post loop:

if ( ! post_password_required( 226 ) ) {
  if ( have_posts() ) :
  // Start the loop. while ( have_posts() ) : the_post(); 

Note: Here on function parameter-post_password_required we had provided the post id of blog page ie : 226.


Please refer this article for making page as passport protected: https://codex.wordpress.org/Using_Password_Protection.

Let me know if you have any question or queries, i will be more than glad to assist you on this stuff.



Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: