Documentation

Print This page

How To Exclude The Pages/Posts From Force Login Feature (Hook)

If you want to exclude the specific pages or posts (like the Privacy Policy page) from the LoginPress Force Login feature means if a user wants to view any page or post content then they don’t need to log into the website/blog. To exclude the specific pages or posts from force login feature, you need to add the following piece of code given below in your Child Theme’s file functions.php and update the file.

function loginpress_exclude_forcelogin_callback() {
return array( 'privacy-policy', '1' ); //Here '1' is the ID of the post.
}
add_filter('loginpress_exclude_forcelogin', 'loginpress_exclude_forcelogin_callback' );

Here you can return a single value or array. You can return the slug of the post or the post-id.

Check our detailed guide on how to exclude specific user roles from the session expiration feature in LoginPress.