WordPress.org

Support

Support » How-To and Troubleshooting » get_post Does Not Return Correct Results

get_post Does Not Return Correct Results

  • I have a custom content type called ‘rs_invoice’. There are six posts with this type. Their IDs are: 960, 950, 910, 890, 1069, and 1070.

    Using WP_Query correctly returns all of these posts.
    $invoices = new WP_Query( array('post_type' => 'rs_invoice') );

    Using get_posts returns all but 1070.
    $invoices = get_posts( array('post_type' => 'rs_invoice') );

    Why would WP_Query and get_posts, given identical arguments, return different results?

  • The topic ‘get_post Does Not Return Correct Results’ is closed to new replies.