July 20th in Wordpress by pbu .

WordPress query posts with tags not working!

i have been struggling with querying posts using tags and have found no solutions whatsovever.  My idea is to query all wordpress posts having the same tags using query_posts and this just not working and giving weird results

query_posts('cat=-53&tag=best php scripts');
query_posts('cat=-53&tag=best+php+scripts');
query_posts('tag=best,php,scripts');

and tried every combination and it seems to be  issue with wordpress 3+ version. Combining with categories also not working.

I have also tried using this code in the single.php page by retrieving tags and querying for posts.  It also doesnt work.

$tags =  get_the_tags($post->ID);  

 if ($tags) {
 foreach($tags as $tag) {
 $tag = $tag->name . '';
 }
 }
query_posts('cat=-53&tag='.$tag.'');

Still havnt found any solution for this myself.

Similar Posts:

Share and Enjoy:
  • del.icio.us
  • digg
  • StumbleUpon
  • Technorati
  • DZone
  • Facebook
  • FriendFeed
  • Reddit
  • RSS
  • Twitter

Leave A Comment.