[wp-trac] [WordPress Trac] #14167: get_posts on 'tag_id' doesn't work

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 1 14:19:14 UTC 2010


#14167: get_posts on 'tag_id' doesn't work
--------------------------+-------------------------------------------------
 Reporter:  dphiffer      |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:                 
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 Here's a Page template test case:

 {{{
 <?php
 /*
 Template Name: Tag test
 */

 $tag_id = 123;
 $tag = 'foo';

 $posts = get_posts(array(
   'tag_id' => $tag_id
 ));

 foreach ($posts as $post) {
   echo "$post->post_title<br />";
 }

 echo '<br />';

 $posts = get_posts(array(
   'tag' => $tag
 ));

 foreach ($posts as $post) {
   echo "$post->post_title<br />";
 }


 ?>
 }}}

 The first loop returns the most recent posts instead of those tagged. This
 doesn't correspond to
 [http://codex.wordpress.org/Template_Tags/query_posts#Tag_Parameters the
 documentation], unless I'm misreading it. Behaves this way in both 2.9.2
 and 3.0.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14167>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list