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?
- dbDelta not creating tables
- How to fork a plugin?
- Default table collation on plugin activation?
- How to implement color picker from wordpress in my plugin?
- Nonces can be reused multiple times? Bug / Security issue?
- Single Responsibility Principle and WP Classes
- How to auto-upgrade my plugin?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Displaying search results in the widget itself?
- Missing “category_children” option when dynamically creating categories via a plugin
- How to exclude content (and other returned values) from WP_query()?
- Looking for callback function after Gutenberg is rendered?
- How to duplicate a curl XML request using HTTP API?
- 404 errors after plugin options update and category base change
- how to include javascript file and css file in wordpress
- How to avoid loading same script twice?
- Is there any way to check for user login and send him to login?
- Can I individually style items in the backend widget list?
- Is using WP Transients to save external data for a plugin the best/right way?
- Why is my javascript not invoked in my hooks except wp_head?
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- include wp-blog-header not working on MAMP
- Add a class to a dynamic sidebar’s wrapper
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- Issue regarding $wpdb->prepare()
- Checkbox Undefined index error in Plugin
- Change the look and feel of admin pages
- how to search users by ajax live search
- Generate JSON files for language translation from po file without wp-cli i18n make-json
- Display WordPress the_content() via data attributes
- Constraints in custom tables for plugin development – Yes or No?
- Run Shortcode of post’s custom field in functions.php / Plugin
- Settings API with arrays example
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- load_plugin_textdomain doestn’t work with add_action plugins_loaded
- add_rewrite_rule behaving strangely
- wp_get_post_terms Order by not working
- Naming conventions when using (PHP5) namespaces?
- Readme.txt seems to be cached but not the version
- Issue on Checkbox with Custom Option Page
- change add to cart button link [closed]
- Encoding Method for URLs?
- Store custom meta box data as serialized array
- Using Product variations as product addons
- Change author permalink to external URL
- How to get post meta in functions?
- AJAX request not routing through proxy
- Plugin access to average users not only admin
- Custom Settings Plugin Save foreach checkboxes
- Rewrite not working since upgrade to 5.9
- Why won’t this submenu page show? – My First WordPress Plugin
- wordpress full site editing problem when extending core blocks
- How to check if `comment_meta` exists before inserting the comment?
- Multiple dynamic Tax Query – pass taxonomy argument from array
- Add default custom taxonomy to plugin activation
- ACF Field value in wordpress login message filter
- ajax stopped working when not logged in wordpress
- Overriding the template files using a plugin for all themes
- Woocommerce product not appearing in category list page when created programatically [closed]
- Plugin removes itself if mistake made during edit
- Using meta_key & meta_value in add_rewrite_rule
- implementing socket.io with wordpress
- Custom Registration Form and Passwords
- Determine if the current page, is being edited
- List Table action argument not cleared
- Fullwidth slider using background image Flexslider WordPress
- Return value of $wpdb->update() query in plugin is wrong
- Plugin files not updated (cache cleared)
- How to limit the number of posts a user can view based on status
- WordPress permalink setting
- Error when trying to save custom post type settings (ERROR: options page not found)
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- How to call a new php page inside a plugin page?
- How can i call from custom fields to the category editor?
- Practical Solutions to HTML5 Video on WordPress
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- Is the only way to add taxonomy terms via an admin panel?