Created
September 18, 2020 08:27
-
-
Save sabrina-zeidan/2f9d7244447acfc72e6498413deef79b to your computer and use it in GitHub Desktop.
Filter Elementor query by ACF [WordPress]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//custom-query-name is set in Elementor as query ID | |
add_action( 'elementor/query/custom-query-name', function( $query ) { | |
$meta_query = (array)$query->get('meta_query'); | |
$meta_query[] = array( | |
'key' => 'custom_field', | |
'value' => '', | |
'compare' => '!=', | |
); | |
$query->set('meta_query',$meta_query); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment