Binit Ghimire
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Possible to make entire site private without plugin?You’re welcome, @vytaulla51!
Forum: Fixing WordPress
In reply to: Privatize my wordpress siteYou don’t have to look for any plugin to achieve your requirements, because the feature is already available within the WordPress Dashboard.
The only thing you have to do is to visit your WordPress Dashboard, click on “Settings” so that it sends you to the “General Settings“, and then put tick on “Anyone can register” so that visitors can register on your website, and to make them unable to access the WordPress backend, select “Subscriber” in “New User Default Role” area just below “Anyone can register” in the “Settings”.
Forum: Fixing WordPress
In reply to: Possible to make entire site private without plugin?Yes, you can achieve your requirements without having to install a new plugin. You just have to place a small piece of code in the index.php file of your theme.
You can follow the steps below:
Step 1. Visit your WordPress website’s Dashboard.
Step 2. Hover over “Themes” and click on “Theme Editor”, and it should send you to /wp-admin/theme-editor.php.
Step 3. By default, the stylesheet file would be opened when you visit “Theme Editor”. So, the next thing you need to do is to find “Main Index Template: index.php” in the “Theme Files” area, and click on it.
When you do so, it will load the contents of the index.php file of your theme.
Step 4. Now, place the following code by creating a new line after “<?php“:if(!is_user_logged_in()) { wp_redirect( wp_login_url() ); }
Step 5. Now, click on the “Update File” button!
With that being done, try visiting your website without being logged in, and you should see it redirects to the login page without displaying any content of your website.
I hope you would be able to achieve your requirements by following the above mentioned steps.
- This reply was modified 5 years ago by Binit Ghimire.