Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#13150 closed defect (bug) (worksforme)

get_posts( post_type=x & custom_tax=y ) ignores the custom post type

Reported by: bobsoap Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: custom post type, custom taxonomy
Focuses: Cc:


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.


//the taxonomy
	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

//returns all posts with the genre "my-genre", even when they are not a "genre_descriptions" post type

WP 3.0 beta 1

Change History (2)

#1 @michaelh
8 years ago

Maybe it is this 'status=publish'

This works for me

  'post_type' => 'book',
  'writer' => 'John',
  'post_status' => 'publish',
  'posts_per_page' => -1
echo "<pre>"; print_r($return); echo "</pre>";

If that doesn't resolve it, also there was ticket:13020 last week -- have you updated to the latest nightly?

#2 @michaelh
8 years ago

  • Milestone 3.0 deleted
  • Priority changed from high to normal
  • Resolution set to worksforme
  • Severity changed from major to normal
  • Status changed from new to closed

Closing as worksforme. Please reopen upon new evidence.

Note: See TracTickets for help on using tickets.