[wp-trac] [WordPress Trac] #10934: get_posts with a custom post_type and a custom taxonomy returns empty

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 15 13:26:35 UTC 2010


#10934: get_posts with a custom post_type and a custom taxonomy returns empty
--------------------------+-------------------------------------------------
 Reporter:  jorbin        |       Owner:  filosofo  
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  Taxonomy      |     Version:  3.0       
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
Changes (by pento):

 * cc: pento (added)
  * version:  2.9 => 3.0


Comment:

 Test case:


 {{{
 register_post_type('custom_type', array('exclude_from_search' => false));
 register_taxonomy('custom_category', array('custom_type'),
 array('hierarchical' => false, 'label' => __('Category', 'series')));

 $catid = wp_insert_term('Test Category', 'custom_category', array('slug'
 => 'test-category'));

 $post = array(
         'comment_status' => 'closed',
         'ping_status' => 'closed',
         'post_status' => 'publish',
         'post_author' => 1,
         'post_content' => 'test content',
         'post_name' => 'test',
         'post_title' => 'Test Post',
         'post_type' => 'custom_type');
 $postid = wp_insert_post($post);

 wp_set_object_terms($postid, $catid, 'custom_category', true);

 $single = get_post($postid);
 var_dump($single);

 $search = get_posts('post_type=custom_type&custom_category=test-
 category');
 var_dump($search);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10934#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list