In the header.php of your theme you can add the following code @ the beginning of the php code
if ( is_user_logged_in() ) {
header( 'Location: /' );
} else {
header( 'Location: /wp-login.php' );
}
If the user is not logged it will be redirected to the login form else it will be redirected to the /home page or tha page u want.
Related Posts:
- How to add field for new site-wide option on Network Settings screen?
- Correct way to serialize the data of options table?
- Where should I use get_option in a plugin
- How to tell if plugin has been network activated
- Custom plugin settings: clicking “save changes” does not display success message
- How to get user-meta from Social Login registered users?
- Duplicate settings of master blog to slave blogs in WP multi-site installation
- Environment Specific Options Token
- How do I extract the Alt Text from an image attachment upload via the WordPress Options Framework Plugin?
- Tracking last login and last visit
- How to fetch serialized data from wordpress options
- Some Plugin Settings Are Kept After Removal and Reinstall of the Plugin
- Changing widget options via the functions.php when there are no hooks
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Prevent Brute Force Attack
- Login with email (WP Modal Login)
- Check if the front end user is log in or not
- Get all options saved by another plugin
- Is it ok to call get_option without hooks?
- Enable/Disable WP options programmatically
- add function to saving change on Options Pages
- clean wp_options table unused rows
- How to set CORS header?
- Prepare plugin options for multi-lingual support
- Creating a plugin that will add options. Where should the options menu pages go?
- wp_authenticate but not logged in
- update_user_meta add value on the top on existing value
- Set the active Navigation Menu from a plugin
- Serialize data for wp options
- How do i login when i cant access wp-login.php?
- How to add a default value to get_option if it’s used as a variable?
- Single central login for front end users from any site
- WordPress get_option and update_option returned entered on the textbox field
- Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
- How to save generated JWT token to cookies on login?
- changes to widget settings not showing up in individual pages pages until they’re updated [closed]
- Show admin notice on incorrect value on form field
- How to remove traces from widget during uninstallation
- php page not found for plugin options menu
- add tabs in rdp-plugin/includes/settings.php and get settings saved
- options creation for plugins
- get_option error plugin development
- WordPress error: Options page Setting_ not found in the allowed options list
- Change wp-login to custom URL login page
- Allowed memory size exhausted problem
- Plugin getting Cannot modify header information errors
- Saving widget options from class method
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Theme My Login Shortcode Doesn’t Return Anything
- OceanWP settings are missing from Add New Post [closed]
- Possibility to login without password
- Plugin scheduled event not working
- WordPress unable to write files in the server
- Store plugin page content in wp_options?
- How to make a textarea accept javascript in my settings apge?
- How do you add a settings page to another menu?
- How to get values from network settings panel?
- How to add a custom form to a plugin’s setting page
- update_option creates an option, which empties on a blog reload
- How to make sure settings are not lost when plugin is updated?
- Linking form to user meta fields
- WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
- Plugin or ways to limit number of users logging in the website,
- how to show new field if option selected?
- Problem with MEMCACHE and Redis with wp_options
- Changing the CSS with a plugin
- Which membership plugin for a simple sign in? Personal areas for customers
- Login/password protected “client page”
- WordPress Admin login redirect to homepage
- On button click, redirect users to registration page instead of another page
- How to show private pages based on a user’s role?
- Optimized PHP & WordPress settings for speed/performance?
- WP options plugin setting not saving the selected checkboxes
- Enable plugins that are “not supported”
- Registered sidebar area is not shown from plugin.
- Why is the WordPress update_option not working in this code?
- wp_login_form() ignoring login_form action hook
- WordPress update plugin through Dashboard/Plugins displaying error
- Auto-login from backend
- Option page not updating multiple records in settings api
- get_option returning old value for non-admin users
- wp-admin will not redirect to wp-login.php
- Validating values using Settings API?
- Adding google authenticator and use only email address of user
- get Options value in “external” page
- homepage olderposts link showing page not found
- WordPress ReAuth =1 Loop with wpCAS
- WP e-commerce sales-view
- My first plugin doesn’t save the data in options
- Advice on setting up private site
- Checking url from plugin [duplicate]
- Change All Login/Signup Links in Plugin
- plugin for different writers [closed]
- selecting options from another form
- How to resolve these findings from security audit
- ERROR: Cookies are blocked due to unexpected output – no access to FTP
- How to Find WordPress site has backdoor login Codes
- How to create a custom wordpress plugin for a specific functionality?
- How to access values from your own settings page in javascript?
- How to fix a Wordfence scan that doesn’t finish?