Skip to main content
17 events
when toggle format what by license comment
Sep 10, 2014 at 0:49 comment added birgire you're welcome, great if you can use it.
Sep 9, 2014 at 22:53 comment added henrywright Thanks for such a detailed answer, much appreciate your help! Time for me to learn all this :)
Sep 9, 2014 at 22:51 vote accept henrywright
Sep 9, 2014 at 22:33 comment added birgire I updated the answer with a manual SQL query. ps: the default offset is 0 for get_col().
Sep 9, 2014 at 22:33 history edited birgire CC BY-SA 3.0
added 391 characters in body
Sep 9, 2014 at 22:21 comment added henrywright Good point about the output being an array of WP_User objects. That is quite helpful. In my particular case, I just need an array of user IDs. My knowledge of custom SQL queries could be better. Would this be the right way to do it? $query = "SELECT * FROM wp_users WHERE user_registered <= current_time( 'mysql' )"; $user_ids = $wpdb->get_col( $query, 0 );
Sep 9, 2014 at 22:05 comment added birgire I think you could ask the same about WP_Query + hooks versus a custom SQL query ;-) I usually prefer the "flexibility" of WP_Query or WP_User_Query in this case. Additionally the output of WP_User_Query is an array of WP_User objects.
Sep 9, 2014 at 21:58 comment added henrywright Thanks @birgire. Is there any advantage of the WP_User_Query... pre_user_query approach over a simple custom select query?
Sep 9, 2014 at 21:53 history edited birgire CC BY-SA 3.0
added 194 characters in body
Sep 9, 2014 at 21:24 history edited birgire CC BY-SA 3.0
deleted 47 characters in body
Sep 9, 2014 at 21:17 history edited birgire CC BY-SA 3.0
added 1631 characters in body
Sep 9, 2014 at 19:33 history edited birgire CC BY-SA 3.0
added 72 characters in body
Sep 9, 2014 at 19:31 comment added birgire Maybe, but some prefer to work in PHP instead of SQL, hence your solution ;-)
Sep 9, 2014 at 19:30 comment added Pieter Goosen Think your approach might be faster than mine :-)
Sep 9, 2014 at 19:25 history edited birgire CC BY-SA 3.0
added 64 characters in body
Sep 9, 2014 at 19:20 history edited birgire CC BY-SA 3.0
added 64 characters in body
Sep 9, 2014 at 19:13 history answered birgire CC BY-SA 3.0