How to Make your WordPress Blog Private

Make WordPress private

Would you like to make your WordPress site completely private? I'm often asked for help by certain profiles who want to use their website to share certain files privately, such as parents who share photos of their children, or certain private events with their family and friends.

In this article, you will learn how to make your blog in WordPress completely private. I will also teach you how to create a password-protected page or entry, for those who want to have a blog with a private area.

Table of contents

  1. What is a private WordPress blog for?
  2. Creating a blog in WordPress with a password
  3. Completely private WordPress without plugins
  4. Private pages in WordPress without plugins

What is a private WordPress blog for?

  • A private blog in WordPress is useful for sharing your family events, such as your wedding photos or those of your children.
  • A private blog can be used as a personal journal.
  • Teamwork can be optimally carried out using a private blog.
  • For a website under construction that is not ready for the public.

Creating a blog in WordPress with a password (Plugin)

The first thing to do is install and activate the My Private Site plugin.

My Private Site plugin

Once activated you will have to go to Settings My Private Site to correctly configure the Plugin.

The first thing you have to do, once inside the "Make Site Private" menu, is to check the "Private Site" checkbox.

Private Site Checkbox

The next section is to allow users to register on your WordPress website. If you don't need to enable the registration of new users you can skip this step.

In "Landing page" you can choose which page will be shown to users when they identify themselves. By default, the plugin will automatically direct you to the page from which you have logged in. The possibilities at this point are several

  • Direct you to the homepage
  • Direct you to a specific page
  • Direct you to the WordPress Dashboard
  • Return the user to the page from where he was identified.

The "Custom login page" option is only applicable if you are using a custom login page. If so, you will only need the URL, and the plugin will use it as the default login page.

My Private Site allows you to make parts of your website public. Very useful if, for example, you are using a static web page and you want users to register through it. You can also make the contact or introduction pages public.

Don't forget to click on the "save changes" button before leaving the page.

This is it, now your visitors will need to identify themselves to access the content of your page.

Depending on your configuration, users will be able to see certain pages or only the identification screen.

Completely private WordPress without plugins

If you are one of those allergic to plugins, Here is an alternative. But this method requires some modification in the theme’s functions.php file, and this will work perfectly in most hosting services: 

function make_wordpress_site_private(){
  global $wp;
  if (!is_user_logged_in() && $GLOBALS['pagenow'] !== 'wp-login.php'){
    wp_redirect(wp_login_url($wp -> request));
add_action('wp', 'make_wordpress_site_private');

Once done, this code will have the same effect as the My Private Site plugin. Users who are signed in can be able to browse the site without restraints, while anyone else will be redirected to the login screen.

If possible, add this code to the child theme of your new website then remove it if you going online. This will make your entire WordPress website private. You must add this code to the parent theme, but keep in mind, that it can be lost during updates.

Private pages in WordPress without plugins

I don't want to end this article without remembering that WordPress allows you - without any additional plugin - to make both posts and private pages protected by a password. It can be applied to both new and old entries.

In the post editor, you have an option called visibility, in the options menu on the right sidebar. Once there, click on the edit link, to the right of visibility, and you will be able to configure the password for that specific page or post.

Protect posts by password

Note that users with an editor or administrator role will be able to access password-protected posts from the WordPress dashboard.

So, this little tutorial has come to the end. If you found it interesting or you think it could be useful to another person, I will appreciate it if you share it on social networks.

Thank you!

Feel free to drop me a line or ask any questions in the comments below!