WordPress.org

Ready to get started?Download WordPress

Forums

Stange meta_query results (1 post)

  1. philippze
    Member
    Posted 2 years ago #

    Hallo!
    I thought that one could use meta_query to find fields which have a certain meta_key and meta_value. Hovever, when I put this code somewhere on my webpage:

    $q = new WP_Query( array(
        'meta_query' => array(
            array(
                'key' => 'Frog',
                'value' => 'Duck',
            )
        ),
    ));
    while ($q->have_posts() ) {
        $p = $q->next_post();
        echo $p->ID . '<br>';
    }

    this prints "6
    139" although I have no post with meta_key "Frog" neither a post with meta_value "Duck". Altogether, I have 174 distinct post_id's in my table wp_postmeta, and I have no idea what is special about post no. 6 and no. 139.

    Ideas?
    Philipp

Topic Closed

This topic has been closed to new replies.

About this Topic