[wp-testers] possible bug in get_posts

Daniel Tweedy daniel.tweedy at gmail.com
Sun Jan 30 23:49:58 UTC 2011


I believe that I may have accidently stumbled upon a bug in the 
get_posts function.  It can be replicated with the code below, the bug I 
feel is as follows when the below code is used for posts and pages it 
works fine, however when used for custom post types, it seems to be 
ignoring the custom post type and outputting the list of posts as per 
the default.  I have tried and tried to login on the trac, but my 
wordpress.org username and password doesn't seem to work on it.  If 
people here feel that it is in fact a bug please could someone file it 
for me, or if not could someone tell me what it is I have done wrong ?

$post_types = get_post_types(array('public' => true, '_builtin' => 
false), 'objects');

foreach ($post_types as $post_type) {
   // Set options for query
   $post_args = array(
    'numberposts' => '-1',
     'post_type' => 'movies',
);

$theposts = get_posts($post_args);

foreach($theposts as $thepost) {
   $custom_post_types .= '<li><a href=' . get_permalink() . ' title="' . 
sprintf(esc_attr__('Permalink to %s'), the_title_attribute('echo=0')) . 
'" rel="bookmark">' . get_the_title() . '</a></li>';
}




More information about the wp-testers mailing list