WP_User_Query is Not Displaying Results

Here is a basic example of a user query I’m using that is working. Please note that I am using the role__in argument instead of the role argument. I’m not sure why the role argument wouldn’t work for you but I know this code works so hopefully it will work for you as well. $args … Read more

Wp_user_query search by meta_key not returning any results

You’re setting two different meta_key fields to check on: ‘course’, and ‘clinic’. Try doing it with just one like so: $args = array( ‘orderby’ => ‘display_name’, ‘fields’ => ‘all’, ‘search’ => $search, ‘meta_query’ => array( array( ‘key’ => ‘clinic’, ‘value’ => $search, ‘compare’ => ‘LIKE’ ) ) ); What your current query is doing is … Read more

WP_User_Query with 2 sets of conditions ‘AND’

You have an example here: https://codex.wordpress.org/Class_Reference/WP_User_Query#Custom_Field_Parameters Problem with your query is that you use wrong keys. It should be: $args = array ( ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => $campaign_type, ‘value’ => $Campaign_ID, ‘compare’ => ‘=’ ), array( ‘key’ => ‘organisation’, ‘value’ => $userOrg, ‘compare’ => ‘=’ ) )); Longer versions (meta_key, … Read more

custom post type ‘pre_[cpt]_query’ hook

WP doesn’t provide (as far as I remember) hooks specific to CPTs. There are a lot of hooks in WP_Query class to bend the post queries different ways. In most cases they are passed the query object itself, which is used to derive the context (such as is query for specific post type).

WP_User_Query Filter Results

Mostly a PHP question but if I understand your question, you want something like this: $args = array( ‘role’ => ‘talent’, ‘order’ => ‘DESC’, ‘orderby’ => ‘user_registered’, ‘meta_key’ => ‘position’, ‘number’ => ’15’ ); $meta = array ( array( ‘key’ => ‘picture’, ‘value’ => array(”), ‘compare’ => ‘NOT IN’ ), array( ‘key’ => ‘position’, ‘value’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)