WordPress.org

Ready to get started?Download WordPress

Forums

Get authors latest post-type="attachment" (1 post)

  1. nathanduckett
    Member
    Posted 1 year ago #

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

    So far i have

    <?php
    	$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

Topic Closed

This topic has been closed to new replies.

About this Topic