get_last_post( $post_type )


Source Source

File: tests/utils.php

function get_last_post( $post_type ) {

    $recent_posts = wp_get_recent_posts(array(
        'post_type' => $post_type,
        'numberposts' => 1, 
        'post_status' => 'publish'
    ));

    return array_shift( $recent_posts );
}