WordPress.org

Ready to get started?Download WordPress

Forums

meta_query not behaving as the codex says (2 posts)

  1. Robert Simpson
    Member
    Posted 1 year ago #

    Hi folks,

    According to http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters (Multiple Custom Field Handling section) a meta_query array should be performing an OR comparison between the different arrays within, mine seems to be performing an AND comparison.

    Here's my query details: http://pastebin.com/KbHpLRqs

    If key 4 is empty is works, otherwise it returns nothing.

    The ones which match key 3 should appear whether key 4 matches any posts at all, right?

    Cheers,
    Rab

  2. Ken Dirschl
    Member
    Posted 1 year ago #

    I believe you have to specify 'relation' => 'OR'; I don't see it documented as the default, and meta_query is definitely performing 'AND'. Check the second example under 'Multiple Custom Field Handling'.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags