How to Stay Logged in for a longer period in your WordPress?

Step::1 First of all you must know the theme which is currently activated in your website.

So for that login to your WordPress dashboard and go to Appearance tool and choose the Theme option

Step::2 From here you can know the Current active theme

Step::3 Now that you know the theme, login to your cPanel and click on File Manager section

Step::4 Go to public_html

Step::5 Go to the WordPress installation directory and open wp-content folder

Step::6 Now go inside themes folder

Step::7 Next go to the active theme(for ex. eduexpert) directory

Step::8 Find functions.php file and right click over the file and choose the Edit option

Add the following code snippet to the functions.php.

add_filter( 'auth_cookie_expiration', 'stay_logged_in_for_1_year' ); 
function stay_logged_in_for_1_year( $expire ) {
return 31556926; // 1 year in seconds
}


Step::9 You can even customize the time and update accordingly if you want to be longer or shorter.

Step::10 Finally click on Save Changes button.

Visit our Blog for more details. You can also watch the video here

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Fix WordPress error “There has been a critical error on your website”

Step::1 First of all login to your cPanel and go to File ManagerStep::2 Go inside public_html and...

How to bulk delete spam comments in your WordPress website?

Step::1 Login to your cPanel and click on File Manager sectionStep::2 Go to public_html and then...

How to Change WordPress logo in wp-admin page?

Step::1 Login to your cPanel and go to File Manager sectionStep::2 Now go to Public_html Step::3...

How to Change WordPress Admin Username?

Step::1 Login to your WordPress dashboardStep::2 Now at the same time login to your WordPress...

How to Set Default Timezone in your WordPress website?

If you want to set timezone as per your country’s location then in that case you just need to...