[wp-trac] Re: [WordPress Trac] #7326: get_posts not working properly

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 17 00:44:15 GMT 2008


#7326: get_posts not working properly
---------------------+------------------------------------------------------
 Reporter:  wpcandy  |        Owner:  anonymous
     Type:  defect   |       Status:  new      
 Priority:  high     |    Milestone:  2.6.1    
Component:  General  |      Version:  2.6      
 Severity:  normal   |   Resolution:           
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by DD32):

 While i'm not using
 {{{
 foreach($lastposts as $post) : setup_postdata($post);
 }}}

 I've found get_posts() to be working ok:
 {{{

         $posts = get_posts(array('tag__in' => array($tag->term_id),
 'number' => 5 ));
         $html .= '<h4>Recent Posts</h4>';
         foreach ( (array)$posts as $post )
                 $html .= '<a href="' . get_permalink($post) . '">' .
 get_the_title($post) . '</a><br />';
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7326#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list