Support » Fixing WordPress » Get authors latest post-type="attachment"

  • Hi i am trying to get the latest post with post type attachment for the author.

    So far i have

    	$args = array( 'numberposts' => 1, 'author' => $user->ID, 'post_type' => 'attachment', 'post_status' => array('inherit', 'publish', 'pending', 'draft') );
    	$company_posts = get_posts( $args );
    	echo $company_posts[0]->ID;

    This returns the id of the latest post_type “job_listing” by the given author.

    I want it to return the id of the latest post by the given author with post_type “attachment”

    Any ideas?

    Thanks Nathan Duckett

  • The topic ‘Get authors latest post-type="attachment"’ is closed to new replies.