You are using an undefined variable in your code ($padeid), it can be causing you problems. Try this code instead:
add_action('template_redirect','wpse16975_check_if_logged_in');
function wpse16975_check_if_logged_in(){
global $wp;
if( ! is_user_logged_in() ) {
$url = wp_login_url( site_url( add_query_arg( array(), $wp->request ) ) );
wp_redirect( $url );
exit;
}
}
Related Posts:
- How to restrict a page [without plugin]
- Hiding posts from non logged in users
- Restrict access to specific users
- How do we restrict a user to see a field in a post without registration,
- Hide posts of particular category for everyone except of particular user group or role
- How prevent direct access to PDF file
- How restrict video to be open on direct url hit
- Disable Page if user not logged in
- Learndash groups content protection with tags
- How can i restrict a page to certain user roles?
- Segregating content in a blog for 2 different readers
- Restrict directory listing to only logged in users
- Restrict content even to specific user
- I want to restrict a page for subscriber and contributor
- How to stop EU users from accessing my website?
- How to protect content from public users and limit access to certain roles in WordPress 2023?
- How to restrict attachment download to a specific user?
- simple solution for restricting access to (some) uploads/downloads
- Correct Post Count ( All | Published | Drafts | Pending | Trash ) for Custom Post Type when restricting to view own posts
- User redirect to destination URL after login
- Create a USERNAME and PASSWORD protected WordPress page
- Loading posts associated only to the logged in user on recent posts page
- Does pre_get_posts affect REST API responses?
- Restrict post edit/delete based on user ID and custom field
- How do I display a user specific content?
- Paid member plugin with some specific features [closed]
- How can I limit functionality in one version of a plugin?
- Shared Members between two different wordpress installations with different databases
- BuddyPress | Check if user is in current group [closed]
- Restrict access to post if it is currently being edited
- Add new password rule to Ultimate Member register form
- How to Make a Custom Dashboard Widget to Display Custom Notification from Admin?
- how to make author to write comment on only his own posts?
- setting a specific home page for logged in users
- Restrict the user access in multi site for non-assigned blogs
- Restrict access to the Trash folder in Posts
- Restrict backend but allow to use post.php?action=delete&post=POSTID from front-end
- Custom Roll/Custom Post Type – Can’t Select Categories
- WordPress roles – Protect administrator role
- Restrict certain posts from being sent to the feed subscribers
- Removing WordPress Plugin Menu Item for a specific user
- Identical members roles on all sites in a multisite
- Members area with externally-managed htaccess / htpasswd authentication?
- Allow access on a page to just only a specific member
- Restrict PDF links
- Limit REST API output to current logged in user that is also author of the content
- WordPress stripping html and script tags from some admin users on save
- Taxonomies, restrict editing and creation of terms?
- Private member page
- Hide everything on site for visitors except specific page IDs
- Restrict Login Subscriber users from accessing frontend
- Restrict other Admins from using Editor in Admin Panel
- How to restrict the editors from viewing/editing pages created by admin?
- BBPress private topics by default
- Password protect the site (without htaccess or membership)
- Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx – not only Apache – solution
- Redirect user to login before viewing custom post
- not logged in users can’t submit form
- Is it possible to restrict viewing of category PAGE to logged in users only?
- Page Restriction and Redirect for Particular Levels or user
- Member plugin – register approval, restrict downloads, members only pages
- Removing all trace of member profiles
- Team club with CPTs and user registration + user dashboard
- Protect sequence of pages with same password for each of two groups of users
- How can I restrict image upload dimensions for non-admin WordPress users?
- How to restrict logged user to view only certain pages?
- Limit post display to post authors and create an exception for specific pages
- Use an activation code to change a role [closed]
- User registration
- Change url links on members loops in buddypress
- Restrict certain character combinations in username during registration
- Facebook login for private group members
- How to show post content before read more tag (excerpt) for password protected posts?
- Add additional ‘description’ field for defined roles / role metadata?
- How do I log out users from a restricted page if they are already logged in on another device? [closed]
- Are exclusive taxonomy terms possible?
- Addin plugin custom post type to members plugin
- Restrict access to content in conjunction with facebook connect & google login
- Conditional menu for registerd users/guests (Genesis framework)
- Remove admin menu
- IF user is logged in only show certain page
- I restricted wordpress by logged users. It’s possible exclude a page?
- Limit file downloads to logged in users (WP + Nginx)
- Make pages visible to only logged in members
- How to properly print a 404 error without redirecton? (i.e. keeping the current URL)
- How to allow registered users to submit the form only 5 times per day?
- Can I get an email notification when media is uploaded to the media library?
- Get a remote post ID via API given URL
- Restrict content based on buy woocommerce product
- Showing content to specific BuddyPress Member Types
- User restricted only show posts assigned to current user
- How to force acceptance of site terms on first login?
- One Site as a part of Multisite to be hidden (Un-published) from Public?
- Restricting page access [closed]
- Restrict access to trash, only admin
- WordPress before save / update member
- Display count of new members registered today [closed]
- Downloadable content only for subscribers?
- Hide front-end from every logged out user and redirect them to the default login page
- Restrict the list of parent pages to only those which are created by current user