WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to implement this query using WP_Query().

    FROM wp_posts as posts 
        LEFT OUTER JOIN wp_postmeta as postmeta 
        ON (postmeta.post_ID = posts.ID) 
        LEFT OUTER JOIN wp_term_relationships as taxonomy_rel 
        ON (taxonomy_rel.object_id = posts.ID) 
    WHERE posts.post_type='care-agency' 
        AND posts.post_status = 'publish' 
        AND postmeta.meta_key = 'wpcf-listtype' 
        AND postmeta.meta_value = 'Enhanced Listing' 
    GROUP by posts.post_title 
    ORDER BY posts.post_title 
share|improve this question
What do you exactly want as the result? – Rutwick Gangurde Sep 18 '12 at 5:30
Close voting as not a real question. – Brian Fegter Sep 25 '12 at 1:11
$args = array( 'post_type' => 'care-agency', 'meta_key' => 'wpcf-listtype', 'meta_value' => 'Enhanced Listing' );
$loop = new WP_Query( $args);

if ( $loop->have_posts() ) {

    while ( $loop->have_posts() ) : $loop->the_post();

        //Here goes my loopy stuff

All taken from the codex on WP_Query.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.