[wp-trac] [WordPress Trac] #13150: get_posts( post_type=x & custom_tax=y ) ignores the custom post type
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 27 16:16:52 UTC 2010
#13150: get_posts( post_type=x & custom_tax=y ) ignores the custom post type
--------------------------+-------------------------------------------------
Reporter: bobsoap | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 3.0
Component: Post Types | Version: 3.0
Severity: major | Keywords: custom post type, custom taxonomy
--------------------------+-------------------------------------------------
When calling get_posts with both a custom post type and a custom taxonomy,
all posts that are attached to that taxonomy are returned, regardless of
the post type.
Example:
{{{
//the taxonomy
register_taxonomy(
'genre',
array('movies','genre_descriptions'), //attach to 2 objects
array( 'hierarchical' => false,
'label' => 'Genre',
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => ''),
'singular_label' => 'Genre'
)
);
//trying to get only the genre descriptions for a genre
get_posts('post_type=genre_descriptions&genre=my-
genre&status=publish&posts_per_page=-1')
//returns all posts with the genre "my-genre", even when they are not a
"genre_descriptions" post type
}}}
WP 3.0 beta 1
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13150>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list