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?
- 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
- 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?
- Shared Members between two different wordpress installations with different databases
- 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?
- 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
- Restrict certain posts from being sent to the feed subscribers
- 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?
- How to restrict the editors from viewing/editing pages created by admin?
- Password protect the site (without htaccess or membership)
- 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
- Team club with CPTs and user registration + user dashboard
- Use an activation code to change a role [closed]
- Are exclusive taxonomy terms possible?
- 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
- 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]
- Hide front-end from every logged out user and redirect them to the default login page
- Should I setup frontend-only users as CPT or use a plug-in?
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- Requiring login for specific pages
- How do i put in user id in a banner
- Let users register and show them a members only area (without plugin)
- Require re-login when logged-in user attempts to access restricted page
- How to restrict a plugin from certain pages without editing its core
- SQL Query members by profile fields Buddypress [closed]
- Add number of members to “Right Now” dashboard widget
- conditional statement for profile pages
- Alter BuddyPress member search to include search on added profile fields [closed]
- How do I “trash” a custom post type post while logged in as Admin
- Show content if user left comment / non-logged visitors?
- create a custom query for posts managed by Restrict Content Pro
- Members only function, but allow account activation [solved]
- Limit users to specific uploads
- How does a WooCommerce site integrate with the existing real world customer members?
- Allow members to create groups on my site
- After reading 3 story by user ask for subscription popup
- grant multiple roles access to specific admin menu item
- Allowing custom role user to edit post assigned to them but don’t let them create new custom type post
- Public WP website with one area just for members
- Send a password to a user who has just registered for a member area
- What permissions does a role need for the user to be assigned as the author of a post?
- Restrict access if logged out except for homepage
- How to block access to a folder inside of wp-content for non logged in users?
- WordPress Front-End user restricted taxonomies
- How can you disable search for non-members on your WordPress website.
- Multiple domains, Single database, 1 Parent/Master with all content, other domains/slaves with filtered content (based on “location” variable)
- Restrict access to custom post type and filter from every query
- Set user role on registration so can upload file to own media library area
- Store members in custom taxonomy or native user?
- Set the limit to allow author when make post!
- Hide page link in main menu from anonymous users
- How to give members access to their own protected page?
- Avoid too long words in a post title, post content or comment but only if its not a url
- Redirect non-members to about/intro page
- How do I protect my uploads?
- Premium Members Section of website
- Using Conditional Tags to restrict something to 1 user?
- one time visit to the page
- Sync roles across several plugins
- I need help about wordpress of members section
- How to change user role setting in members plugin so that user can only edit his own post?
- Hide custom posts from certain taxonomy in rest api