I’m stuck at a very simple point: I need to get all attachments by a custom meta key (and value). I’m developing a short code, so it has to work on every possible page.
What I’ve tried so far:
$args = array(
'post_type' => 'attachment',
'meta_query' => array(
array(
'key' => 'medientyp',
'value' => 'Video'
)
)
);
$query = new WP_Query($args);
But that does not find anything (yes, there do entries exist.)
Did I get something wrong? Or do I miss something?