Learn how to adjust the cookie expiration time for guest users on all lists such as wishlist and waitlist within our plugin. Explore the default settings and follow a simple step-by-step guide to customize the expiration time according to your preferences using “wlfmc_cookie_expiration” function.
Change Cookie Expiration Time for Guest Users #
The “wlfmc_cookie_expiration” function hook is utilized within the context of managing cookie expiration times for guest users on all MoreConvert lists.
By default, the cookie expiration time for guest users on lists is set to 30 days.
You can customize the cookie expiration time by implementing a filter and specifying your desired expiration time in seconds.
Here’s a snippet you can add to your theme’s functions.php file:
add_filter( 'wlfmc_cookie_expiration', 'wlfmc_customize_expiration');
function wlfmc_customize_expiration(){
// Set the expiration time to 60 days (60 seconds * 60 minutes * 24 hours * 30 days)
return 60 * 60 * 24 * 60 ;
}
In this snippet:
- The “add_filter” function is used to hook into the “wlfmc_cookie_expiration” filter.
- The “wlfmc_customize_expiration” function is defined to specify the customized expiration time.
- The return statement within the function calculates the expiration time in seconds. In this example, the expiration time is set to 60 days.
Step-by-Step Guide to Adding the Customization Code to functions.php: #
- Log in to your WordPress admin dashboard.
- Navigate to the “Appearance” section and click on “Theme Editor”.
- Locate the “functions.php” file on the right-hand side.
- Scroll to the bottom of the “functions.php” file.
- Copy and paste the provided code snippe.
- Customize the expiration time by modifying the calculation in the “wlfmc_customize_expiration” function according to your preference.
- Click on the “Update File” button to save your changes.
Congratulations! You’ve successfully customized the cookie expiration time for guest users on lists using our plugin. Enjoy the enhanced flexibility and control over user experience on your website. Should you have any further questions or need assistance, don’t hesitate to reach out to our support team.