having problems with filtering a posts attachments by tag… It worked fine until i added the tag__in arg (and other variations of it).
$vidArgs = array(
'tag__in' =>5,
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type'=>'video/quicktime',
'posts_per_page'=>20
);
$videos = get_posts($vidArgs);
foreach ($videos as $vid) { ///....
pointers / advice appreciated!
UPDATES
it is odd. It just doesn’t work with media tags! Added testtag to a post and it comes up.
There must be a way to get attachments by tags? Otherwise what’s the point? The functionality is in wp admin from the Media Tags pane…
$argsc = array(
/* 'tag' => 'commercials,testtag', */
'tag__in' => array(5,11),
'post_type'=>array('post','page','attachment'),
'post_status'=>'any',
/* 'post_parent'=>$post->ID, */
'posts_per_page'=>20
);
$the_queryB = get_posts( $argsc);
echo count($the_queryB).", <pre>";
print_r($the_queryB);
From this page in the codex, i see that this parameter requires an array so i’d try this way:
found n easy way of doing this now! Getting images by ‘your case’ tag and logged in user.
UPDATE. media_tag seems to be a custom taxonomy added by the file gallery plugin.