How to use visual elements to tell a story Let's start with an interesting fact that will amaze you. Do […]
The Ultimate Guide to Choosing a Great Domain Name for Your Business

Choosing the right domain name for your business is a critical step in building a strong online presence. Your domain […]
6 Mistakes to Avoid When Creating a React-Native App

React Native is a leading cross-platform app development framework that has more than one and half thousand active contributors. The […]
Will Elon Musk Turn Twitter into a Super-App?

Elon Musk envisions a future where mobile apps are consolidated into one-stop shops within a single platform. Will he create a "super app" to rule them all in 2023? Learn about the challenges he faces and the potential impact on companies like Twitter and Apple's App Store.
8 Steps to Start Your Shirt Printing Business like a Pro

The custom design market is rising daily, and its demand is relatively easy to fulfil if you have the right […]
What Is Out-Of-Home Advertising - Types & Strategies

OOH, or out-of-home advertising has been around for a long and is still one of the best ways to contact […]
Best Tools That Make Content Readability Better

These three best tools can enhance content readability: 1) Paraphrasetool.ai 2) Word-counter.io 3) Hemingway Editor. Use these tools and achieve perfection in your work.
How to Lock Entire WordPress Website for the Public Without Plugins

You can lock your entire WordPress website and make it only visible to logged-in users without using a plugin by adding a simple code.

You can lock your entire WordPress website and make it only visible to logged-in users without using a plugin by adding code to your WordPress theme's functions.php file. Here's how you can do it:
Step One: Access functions.php
Access the functions.php file: Go to your WordPress dashboard, navigate to "Appearance" -> "Editor" and select the "functions.php" file.
Step Two: Add the Code
Add the following code to the functions.php file:
function private_site() {
if (!is_user_logged_in()) {
wp_redirect(wp_login_url());
exit;
}
}
add_action('template_redirect', 'private_site');
Step Three: Save & Test
Save the changes: After adding the code, click the "Update File" button to save the changes.
Test it: Log out of your WordPress website and try accessing a page on your website. You should be redirected to the login form.
That's it!
Your entire WordPress website is now only visible to logged-in users.
This code will redirect any non-logged-in user to the login form whenever they try to access any page on your website.