Support

Account

Home Forums General Issues Filter User don't work

Unread

Filter User don't work

  • Hello,

    i’m trying to filter the user by the meta_query, but this don’t work if i’m using $_GET. I’m using $_GET because the URL pass the param like: example.com/?ministerio=16. If i’m using directly the code of the meta_query, this works.

    My code is below, how can I to fix this?

    function filter_escala_user( $args, $field, $options_post_id ) { 
    	//esta função verifica qual é o ministerio do usuário e exibe para o líder adicionar na escala
    
    			  $ministerio = $_GET[ 'ministerio' ];
            $args =  array ('meta_query' => array(
    	
            array(	
                'key' => 'ministerio',
                'value' => $ministerio,
                'compare' => 'LIKE',
            ),
        )
        );
    		 
            return $args; 
        }; 
                 
        // add the filter 
        add_filter( 'acf/fields/user/query', 'filter_escala_user', 10, 3 ); 
Viewing 1 post (of 1 total)

The topic ‘Filter User don't work’ is closed to new replies.