I have a custom dropdown field in my media uploader which saves to the posts meta. Now I’m trying to get all images with a specific value with a meta_query. The variable $author
is exactly the value that is saved in the postmeta in MySQL.
$rd_args = array(
'meta_query' => array(
array(
'key' => 'post_slider_author',
'value' => $author
)
)
);
$rd_query = new WP_Query( $rd_args );
$mh_posts = $rd_query->posts;
As you can see in the screenshot there is a value assigned to the meta post_slider_author
and ‘1139’ is also the correct ID. Unfortunately the query stays empty.
Additional:
I tried to disable all plugins but it had no effect. Normal queries work just fine.