WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] search template - meta_query (2 posts)

  1. mjoanisse
    Member
    Posted 2 years ago #

    Hi,

    I am putting together a search.php template.

    When I try to query_posts with inclusion of meta_query, it doesn't seem to catch.

    $args = array(
    
    "post_type" => "featured-work",
    "posts_per_page" => "-1",
    'meta_query' => array(
     array(
     'key' => '_fwork_projectclient'
     )
    )
    
    );
    
    $myQuery = new WP_Query($args);
    
    if ($myQuery->have_posts()) :
    while ($myQuery->have_posts()) : $myQuery->the_post();
    
    echo the_title();
    
    endwhile; else:
    endif;

    I've tried this same query on a custom page template and it works as expected.. Any reason for this seemingly odd behavior?

  2. mjoanisse
    Member
    Posted 2 years ago #

    Hi, it turns out there was conflicting function causing the issue in my functions.php file.

Topic Closed

This topic has been closed to new replies.

About this Topic