Below code will work with WordPress default login/register screens:
add_action( 'wp', 'member_only_site' );
function member_only_site( ) {
if ( ! is_user_logged_in( ) ) {
auth_redirect();
}
}
Related Posts:
- New Plugin: Post update pushes a copy as a revision
- How would I go about creating a user ranked post popularity page?
- Create a plugin from within WordPress
- How to create a dashboard for logged-in users with custom functionality? [closed]
- WordPress site server getting blocked due to resource abuse
- I want to move the one click accesbility button on bottom of my website screen,
- What are the differences between WPINC and ABSPATH?
- Is there a plugin that provides a stackoverflow style editor for wordpress? [closed]
- Should all plugins be encapsulated in a Class?
- How can I use WordPress functions in my stylesheet?
- Disable email notification after change of password
- How can I see all the actions attached to an “add_action” hook?
- Who are the most trusted plugin developers? [closed]
- Open Source Forum for wordpress similar to stackexchange or stackoverflow [closed]
- How do I get WooCommerce to automatically recreate pages? [closed]
- wp_dequeue_style not working
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- Consuming an external API in WordPress?
- Uncaught Error: Call to undefined function wp_generate_attachment_metadata() @ wp-cron
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- How to properly insert data into custom table via plugin
- How to get the active theme’s slug?
- Preserve custom URL parameter on more pages
- Recommended eCommerce Plugin for a T-Shirt Sales Business? [closed]
- Is there a good plugin for an online booking system..? [closed]
- InDesign to WordPress workflow
- How can I import a class privately into a plugin?
- __(): What if I have to pass in a variable?
- PHP code on Visual Composer Plugin
- Run WP-CLI using PHP
- Problems with autoloading classes via sp_autoload_register / maybe interfering WP-specific autoloader
- How to make simply “report” button on posts
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Plugin update error message
- Send email when a new post is published [closed]
- How to transfer a WordPress blog to a different domain?
- Keep one user logged for a year?
- How to build an API as a plugin
- Membership / subscription plugins – alternatives [closed]
- Customizing subject in comment notification e-mails
- category_name not working (not showing up in sql query debug)
- Plugin or mod for wordpress to make content publication SUPER easy
- if plugin is active? check if plugin is enabled or not?
- Using require_once in a Plugin?
- Get php var inside javascript file (making plugin)
- How can I make my custom shortcode work in a Custom HTML Widget?
- insert data in database table from plugin with WP3.1
- How Does WordPress Uninclude/Deactivate A Plugin?
- Simple form that saves to database
- Content generator for development site [closed]
- Email Notifications of new posts to users – suggestions [closed]
- WP showing “warning: call_user_func_array()”, What to do?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Searching users with WP_List_Table plugin
- How to override normal WordPress search in Buddypress? [closed]
- How to Loop Plugin Option Field Set?
- Find out what is using PHP sessions in WordPress
- Making plugin unique to not conflict with plugins with the same name
- Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
- How to find out if option exists but is empty?
- How to call plugin path in JS?
- Get Current user email as a return string value
- Insert plugin content before body end
- PHP Deprecated: Non-static method should not be called statically
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Generate custom output for page/URL in a plugin
- how to customize hello dolly plugin?
- How can I pass a variable to wp_ajax action?
- Update Multiple Post Meta for the Same Post In One call?
- WordPress Hook that will run when media file deleted
- Adding Custom Fields for Img in Posts
- Library plugin for WordPress [closed]
- How to store ACF custom fields data in a custom table
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- Bug in Stackoverflow styled badge system script
- Markdown in WordPress 3.2?
- Integrating Google Maps with custom marker and hover?
- How To Ignore a Filter On Applying Filter the Content In a Function
- Updating WooCommerce variable product stock issue
- Saving Plugin settings to the database
- Set a User as Author of all ‘New Posts’ posted
- Auto-post to multiple sites like Posterous? [closed]
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- Network-Wide Plugin Settings Management
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- WordPress widget / plugin….fields not appearing in my widget
- Should I install plugins to my WordPress installation from web sites having in URL “nulled” or, “null”?
- How can I make content disappear when a user logs in?
- Add CSS animation as Preloader to WordPress
- Rename existing old uploaded images containing accented French characters (not during upload)
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Change destination author link
- How to turn off email you receive when registered?
- How can I execute some small piece of PHP code in a sandbox area of my WP?
- How can I include PHP-Code to my post?