Created
December 6, 2022 14:43
-
-
Save everaldomatias/be889c33af104cd35911465aa418e5c2 to your computer and use it in GitHub Desktop.
WordPress: Combine meta_query and tax_query
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
<?php | |
$terms = []; | |
$args = [ | |
'post_type' => 'your_post_type', // change this | |
'tax_query' => [ | |
[ | |
'taxonomy' => 'your_taxonomy', // change this | |
'terms' => $terms | |
] | |
], | |
'meta_query' => [ | |
[ | |
'key' => 'your_post_meta', // change this | |
'value' => 'your_value', // change this | |
] | |
] | |
]; | |
$result = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment