Note that you’re not adding any filter callback with:
apply_filters( 'auth_cookie_expiration', $expiration );
Instead use:
add_filter( 'auth_cookie_expiration', $callback, 10, 3 );
where $callback
is the appropriate filter callback that modifies the expiration.
Here’s an example
add_filter( 'auth_cookie_expiration', function( $length, $user_id, $remember ) {
return $length; // adjust this to your needs.
}, 10, 3 );
or to fit with your current class setup:
add_filter( 'auth_cookie_expiration', [ $this, 'set_auth_cookie_expiration' ], 10, 3 );
where set_auth_cookie_expiration()
is the appropriate method, e.g.:
public function set_auth_cookie_expiration ( $length, $user_id, $remember )
{
return $length; // adjust this to your needs.
}
Related Posts:
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- Rest Api WordPress
- How to check username/password without signing in the user
- Modifying the way WP sets cookies
- custom XMLRPC method plus authentication of user & WooCommerce order
- How to check WordPress website username and password is correct
- Log in from one wordpress website to another wordpress website
- WordPress REST API call generates nonce twice on every call
- WordPress custom authentication implementation
- Security error WP 4.0 + WP phpBB Bridge [closed]
- Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?
- How to extend expiry time of jwt wordpress token?
- How to get the ID of the currently logged in user?
- Will setcookie work if there is a cache plugin installed?
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- Secruity Questions on a timer
- Redirect returning users to a certain page?
- how to add security questions on wp-registration page and validate it
- Why setcookie function redirecting to home page in wordpress?
- How to be GDPR compliant by loading plugins?
- WC REST API Error Handling
- How to hide/remvoe unnecessary field/section in post edit section ( Dashboard )
- Fatal error: Uncaught Error: Using $this when not in object context
- functions won’t fire after I converted my code from procedural code to OOP
- Custom non-template page on front end fails to render
- Add custom parameter for custom user role
- Shortcode content is not showing. Only the [shortcode-tag] is showing
- Post is uncatagorized in publish_post action
- get_queried_object_id combined with wp_redirect gets wrong id
- Stuck on a 504 error
- When does global/main code of plug execute?
- Using WordPress Boilerplate (WPBP) for WP Multisite Plugin
- How to prevent wp_insert_post from creating a new post every second?
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- WordPress Filesystem create CSS-File – get Shortcode ID for Name
- WordPress5.2.3: Better File Download Plugin validation issue
- How do I make secure API calls from my WordPress plugin?
- esc_attr() on hard coded string
- How do I ensure I can loop through every enqueued script and CSS?
- Gutenberg component in a plugin admin
- Creating a return url for getting data from external api
- Always hide a page from the menu
- WordPress discards PNG file when uploading plugin file
- Hook for validating and rejecting frontend image upload
- What is the source of the $post_id in a hook argument?
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Custom Admin Plugin – Injecting repeatable select fields (add, remove) into an Ordered List
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Overriding the template files using a plugin for all themes
- Nested Hooks with do_action for performance reasons – safe/necessary?
- WordPress custom url without using any of the custom tags given
- Counter not working correctly
- Generate Static Page to Show Search Results/Detail for API
- User meta query using Wildcard
- How do I use a plugin to swap out the template file for a custom post type?
- WordPress with React: Saving and Using Data Collected with fetch
- use a (Polymer) web component within a plugin (or theme)?
- Custom Post not Deleting on Uninstall
- Scripts/styles not loading on cloned WP Site when logged in
- Multiple instances of $opt_name in redux framework
- Don’t print customizer styles when no setting has been used
- Initializing rest endpoint issue
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Append php file to footer
- Integrate separate web app inside wordpress [closed]
- How to avoid conflict if a plugin already have included open library?
- Can’t get wpColorPicker to work in a widget
- WordPress OOP get current user question?
- Plugin Activation Causes wp_register errors
- Load custom translation in custom plugin fails
- Add quick edit functionnality to plugin table
- How to filter an action inside class in MemberPress plugin?
- AJAX call of function containing javascript which is not loaded (Plugin development)
- XMLHttpRequest to open PHP file responds with Missing Page
- Extend Cookie with auth_cookie_expiration not working
- Including content into an add_shortcode() function
- Get the current post/page URL with plain permalinks
- Hide / show settings field based on other field’s value
- How to integrate plugins into block editor
- Group By in a Metaquery
- Pre-populated WooCommerce checkout fields: dropdown fields issue
- Using the same class across multiple functions
- Hide post by ‘post_category’
- jQuery dependent script ignores $in_footer bool and doesn’t work in header
- Woocommerce Product finder feature on home page
- How can I measure CPU and RAM used by my theme or plugin
- How do I show the HTML descrption in wordpress photo gallery for my individual gallery pages?
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- Javascript scroll eventHandler only working when I’m logged in in WordPress
- Problem in plugin debuging in wordpress
- WordPress Iframe for blog image
- do I need to sanitize a shortcode’s function input?
- Email content as comment
- How to remove the WooCommerce Product->Category thumbnail from admin [closed]
- WordPress use template
- How to add admin.php to WP Admin Menu Link
- Is it possible to replace MySQL with JSON files for WordPress
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- WP Query date_query with several date range
- Adding body class in author page for custom role