WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12660 closed defect (bug) (worksforme)

WP_Query is broken when using meta_* args

Reported by: ptahdunbar Owned by: ryan
Milestone: Priority: high
Severity: normal Version: 3.0
Component: Query Keywords: reporter-feedback
Focuses: Cc:

Description

There seems to be multiple problems with WP_Query using the meta_* args:

  • Using just meta_key does not return all posts based on the meta_key value.
  • Using just meta_value returns duplicate posts based on the meta_value.
  • Using both, meta_key and meta_value does not return any posts even if posts exists based on those values.

I tested the last changeset of query.php (r13501) which doesn't seem to be the cause.

Change History (4)

comment:1 dd324 years ago

I cant duplicate with my small testset.

Can you post any code chunks you're using, and/or what you expect the output to be?

comment:2 dd324 years ago

  • Keywords reporter-feedback added; needs-patch removed

comment:3 MichaelH4 years ago

Can't duplicate using any variations of meta_* with this in twentyten index.php as of 04/01/10 nightly

$args=array(
  'meta_key'=>'cf1',
  'meta_value'=> 'yes',
  'post_type' => 'post',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null; 
$my_query = new WP_Query($args); 

comment:4 nacin4 years ago

  • Milestone 3.0 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Re-open with steps to reproduce.

Note: See TracTickets for help on using tickets.