Support » Plugin: Elementor Website Builder » Custom Query Filter by user role

  • Resolved alberto3

    (@alberto3)


    I would like to use the Custom Query Filter, to filter by user role:

    https://developers.elementor.com/custom-query-filter/

    Something like:

    add_action( 'elementor/query/editors', function( $query ) {
    	// Get current meta Query
    	$meta_query = $query->get( 'meta_query' );
    	// Append our meta query
      $meta_query = array();
    	$meta_query[] = [
    		'key' => 'role',
    		'value' => 'editor',
    		'compare' => 'in',
    	];
    	$query->set( 'meta_query', $meta_query );
    } );

    Is this possible? Any help would be appreciated.

    Thank you very much!

    • This topic was modified 1 month, 4 weeks ago by alberto3.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.