• Resolved courageous999


    In Ultimate Member v2.0.56, the following code used to work to filter the results of the Members Directory:

    add_filter('um_prepare_user_query_args', 'um_my_custom_query_args', 99, 2);
    function um_my_custom_query_args( $query_args, $args ) {
      $industry = 'doctor';
      // Filter Members Directory by Industry.
      if (!empty($industry)) {
        $query_args['meta_query'][] = array(
          "relation" => "OR",
            'key' => 'pp_industry',
    	'value' => serialize( $industry ),
    	'compare' => 'LIKE'
    	'key' => 'pp_industry',
    	'value' => $industry,
    	'compare' =>  '='

    Now that the Members Directory is displayed through AJAX, the above code does not filter it at all. What’s the new method for filtering the Members Directory in Ultimate Member 2.1.2?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nsinelnikov


    Hi @courageous999

    We checked this code snippet and it still works with Ultimate Member 2.1.x versions. I recommend checking how you get $industry variable in your custom callback functions.


    Thread Starter courageous999


    I used a function that returns an array of variables, one of which is $industry. When I var_dumped the function, that threw a parse_error in your AJAX handler. This function was working just fine before Ultimate Member 2.1.x so I assume something else was at play here.

    Nonetheless, I’ve been able to resolve my issue with Nikita’s help by replacing that function altogether and getting my $industry and other variables through wp.hooks.addFilter. Using that I was able to send my variables as additional request parameters instead.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering Members Directory’ is closed to new replies.