I found it.
After a lot of research I found the way to hook into logout and get user data, and as i was looking for that i found the exact answer i was looking for.
function users_last_login() {
$cur_login = current_time('mysql');
$userinfo = wp_get_current_user();
update_user_meta( $userinfo->ID, 'last_login', $cur_login );
}
add_action('clear_auth_cookie', 'users_last_login', 10);
Thanks for the help guys 🙂
Related Posts:
- Custom plugin: Trying to show saved data on frontend
- Is there a browser plugin or method to find which php template an item is coming from?
- Display message once per session to users with a specific role
- How to correct schedule my event weekly with wp_schedule_event()
- get_the_content if it contains multiple lines it results in SyntaxError
- How can I add a class to a single menu item?
- WordPress returns a wrong date
- How to enlarge the media file upload size in wordpress admin
- How do I hardcode a WordPress shortcode into my theme?
- WPDB: how to get the value of a field in a custom database table
- Debugging PHP object during Ajax call in WordPress
- Display Post co-authored in Author Page
- Include Class File in WordPress
- How to exclude specific category from the get_the_category(); array
- Memory errors with media upload, WordPress can’t use more than 96M (while there’s 512 available!)
- WordPress override bloginfo variable
- How do I display a user’s previous orders as a select box option on a product?
- Hide wordpress field if data is empty in post!
- Show MySQL errors that occur when I excute $wpdb->insert()
- Echo a hierarchical list of post data from custom fields
- The text box have space character
- get_the_tags() not iterating through for/while loop, but will with foreach
- Is there an error in my code?
- Iterate through posts based on array of categories
- How to disable server signature on wordpress? [closed]
- Custom query, checking values of multiple meta keys
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- wp attempt focus, disabling without touching core
- Genesis framework comments broken?
- How to know where this function definition is declared?
- Change CSS based on is_user_logged_in
- Is this spyware on my site or a real Java update?
- Run a code only on theme activation only during first activation
- Shortcode from a function not working
- How to make an embeded a Youtube video from custom field text responsive to screen size?
- Is it best to avoid using $wpdb for security issues?
- Get title attribute from galleries
- How to add text to the start of all comments?
- If else statement to check for thumbnail and whether or not it’s a mobile device – streamline
- How can I automatically resize up images to fit into all of my registered image sizes
- How can I use a sliced image As banner? [closed]
- Compare $_POST returned values with term array
- Correct PHP to output a single result of a Function with SQL Query
- How to remove the h6 tag for the entry-category Class
- Broken kses.php function “wp_kses_named_entities” crashes WordPress
- Understanding webhooks
- if custom field doesn’t exist, use post thumbnail instead, as image background
- Display child page content of a specific parent on home page
- How to add 3 weeks to the_time() function
- wp nav menu: show submenu below li item
- Styling an “active” link outside of WordPress default menu
- Show label for value only when value exists, basic php
- WordPress Custom Query: Combining Two Functions
- Counting number of posts in multiple (sub)categories using shortcode
- Display WordPress search results based on the selected Sub-Category
- Reject all malicious URL requests functions.php
- Using some Loop or repeatable fucntion in AJAX and PHP to reduce repeatability
- How do I call a value from the datase using ajax
- Woocommerce disable order item link (backend) [closed]
- Update PHP version of WordPress (internal hosting)
- Where to add my PHP codes for AJAX Jquery to work?
- Display the list of user’s comments + the post title + date
- Adding ELSE argument to AJAX Live Search for “No results found”
- Multiple Tag Filtering
- Is it possible to change the get_posts() or wp_query() function to alter the results that are returned?
- How to optimize and reduce excessive database queries
- Comparison operator != not working in field [closed]
- Notice: Undefined variable
- Add the shortcodes from the enfold theme to the other theme
- PHP 7.2.18 | Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How can i style “echo apply_filters”
- get_category_parents to array
- How to properly create multiple conditions to redirect users roles to different pages
- unable to add category in creating post dynamically
- making a search.php query
- Splitting table data to pages with numbers
- How do I generate formatted permalinks as specified in backend options?
- Upload images from one server to an other in wordpress
- Ajax not updating to database
- Custom YouTube Plugin loading different PHP library on live site and localhost
- Issue in url update when using wordpress update query
- enumerating custom taxonomies?
- Change colour of table td based on value
- Widget edit and add in any page
- How to use Amazon Elastic Transcoder from WordPress using AWS SDK for PHP?
- Headers Already Sent
- Sum of Custom Meta written by Authour
- Active class not working on custom menu link using add_menu_page
- If or/and statement advanced custom fields [closed]
- Remove duplicates from foreach
- Show items by user_role
- Determine if only one image attached to a post/page
- link to page_for_posts
- get_avatar from user id
- wp_mail vs mail functions and header arrays
- WordPress get_the_term_list include class name for heirachy
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- How to execute a shortcode within a custom field?
- using custom pages for myaccount in woocommerce
- Putting form result in my database