Skip to main content

Posts

Showing posts from February, 2020

Get all meta keys of wp_usermeta using sql query

To get all meta keys of wp_usermeta we can easily group field of meta_key and meta_value. For example: select group_concat(meta_key) as meta_keys from wp_usermeta group by user_id limit 1 \G; Results: *************************** 1. row *************************** meta_keys: nickname,first_name,last_name,description,rich_editing,syntax_highlighting,comment_shortcuts,admin_color,use_ssl,show_admin_bar_front,locale,wp_capabilities,wp_user_level,dismissed_wp_pointers,show_welcome_panel,wp_dashboard_quick_press_last_post_id,wc_last_active,wp_user-settings,wp_user-settings-time,_previous_login,_current_login...

Get the last active time from users in woocommerce using sql query

To easily get the last active time from users (under Woocommerce extended plugin) we can easily query from database using the meta_key of "wc_last_active" example query: select user_id, meta_value from wp_usermeta where meta_key= "wc_last_active" and user_id in (11111,112222); results: +-------------+------------------+ | user_id    | meta_value | +-------------+-------------------+ |   11111   | 1556755200 | |   112222 | 1566518400 |