Filter Loop by Custom Field Value
-
30-10-2019 - |
Question
I'm trying to filter a loop by a custom field value. I've tried all of the suggestions on the site, but it just won't filter. This loop is being used for a custom template of an rss feed. It pulls together the custom post type and only the posts that are "published", but I can't get it to filter by custom field value.
global $wp_query;
$args = array_merge( $wp_query->query, array( 'post_type' => 'custom_type', 'post_status' => 'publish', 'meta_key' => 'my_custom_field', 'meta_value' => 'custom field value', ) );
query_posts( $args );
?>
while( have_posts()) : the_post(); ?>
Any suggestions?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange