How To Exclude Specific User Roles From The Session Expiration (Hook)

If you want to exclude the specific user roles from LoginPress session expiration. The following filter will help you to solve this problem. Simply, you need to add the following piece of code in your Child Theme's file functions.php and update the file.

Note: In LoginPress, by default session expiration period is unlimited otherwise you have to define the session expiration time period in Session expire option in LoginPress settings tab.

function loginpress_exclude_role_session_callback() {
return array( 'administrator', 'contributor' );
}
add_filter( 'loginpress_exclude_role_session', 'loginpress_exclude_role_session_callback' );

Here you can return a single value or array of the roles.

That's how you can exclude specific user roles from the session expiration in LoginPress. Check our guide on how to exclude the pages/posts from force login feature in LoginPress.

Still stuck? How can we help?

Updated on September 13, 2021

Documentation
LoginPress Support
triangular shape yellowish icon

Frequently Asked Questions

Try to find your solution with the frequently asked questions about or services.

three shapes icon

Is LoginPress WPML Compatible?

LoginPress is fully supported with multilingual. LoginPress is also compatible with WPML Plugin, which means you can easily translate your login page with WPML plugin according to the given translation options in the WPML plugin.

Is LoginPress translation ready?

Yes, LoginPress has full translation and localization support via the LoginPress textdomain. All .mo and .po translation files should go into the languages folder in the base of the plugin.

Is coding skills needed to use LoginPress?

No, It is very easy to setup. Just plug and play. Have fun!

How to Install or Use LoginPress Pro?

Step-by-step instructions on How to Upgrade from existing Free version to Pro
1. You have installed and set up the Free version already.
2. Upload the Pro version.
3. Pro features will be enabled automatically.
4. You don’t need to set up Free version options again.
5. Setup Pro features like Google fonts, Google reCaptcha, Choose themes, etc.

Where is my license key?

License key is the Order ID which looks like in this format.
WHI150807-1234-12345
You can find it in the email Sales Receipt.

three shapes icon

If you Still have Questions?

Get In Touch