Using 'meta_query' to filter Posts
-
To allow for easy filtering of Posts with a specific Custom Field defined I’ve added a ‘meta_query’ parameter to the query via the ‘pre_get_posts’ filter.
$query->set( 'meta_query', array( array( 'key' => '_keyresource', 'value' => 1, 'compare' => '==', 'type' => 'numeric' ) ) );
Is there any way I can limit this additional parameter to the main Post loop only?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using 'meta_query' to filter Posts’ is closed to new replies.