here is the issue , I have a wordpress website, which has some categories let say NY & NV & CA. there are posts in each category which may have the same Title. but they have different Tags ob every single posts .
now I want to query post's tags in another page , to show only the very certain post I want to get.
here is the code I am using :
<?php
$args = array(
'posts_per_page' => -1,
'Name' => 'Las Vegas',
'category_name' => 'NY', 'NV', 'CA');
$lastposts = get_posts( $args );
foreach($lastposts as $post) : ?>
<?php
$posttags = get_the_tags($post->ID);
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . '<br/>';
}
}
?>
<?php endforeach; ?>
but the problem is when I run the query is list all the tags in all Categories or it stop listing as soon as it find 'las vegas' which could be a wrong 'las vegas' in another category. I even tries to add only NV as category query but still list the same result.