WordPress.org

Ready to get started?Download WordPress

Forums

WP_Query returns more custom types than requested (1 post)

  1. thinkero
    Member
    Posted 7 months ago #

    Hello,
    I have a very strange situation running WP_Query in order to display the last 'event' records, where 'event' is my custom_type. The code is the following:

    $args_events = array(
    'post_type' => 'event',
    'order' =>'DESC',
    'orderby'=> 'date',
    'showposts' => 15);
    $query_events = new WP_Query( $args_events );

    The problem is that the query returns not just 'event' records, but also other custom types. I'm writing here hoping someone else experienced the same situation.

    Running

    query_posts(array(
    'post_type'=>'event',
    'orderby'=>'date',
    'showposts'=>15));

    I got only events, but sorting by date DESC is not working for unknown reason.

    Thank you in advance,

Reply

You must log in to post.

About this Topic