Support

Account

Home Forums Front-end Issues What's wrong with this Query Reply To: What's wrong with this Query

  • Hi @melissaspiegel,

    Thanks for the post.

    I believe you will need to add the meta_query for the ‘is_event’ custom field and comment out the meta_query that you have.

    Your code should ultimately look like so:

    <?php
    $events = array (
    ‘tag_name’ => ‘oldevents’,
    ‘posts_per_page’ => ‘9’,
    ‘post__not_in’ => get_option(‘sticky_posts’),
    ‘orderby’ => ‘meta_value_num’,
    'meta_key' => 'event_date',
    'order' => 'ASC',
    
    );
    
    // The Query
    $the_query = new WP_Query($events);
    ?>