WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have built a wordpress theme in which I have listed employees of the organization via custom post type. And I am displaying each employee via custom post type.

The employees listed are authors in my website too and they regularly write posts. When I am viewing each employees Profile page, I want to show the lst post written by that employee.

I hope I am clear in my explanation.

Please help me...

share|improve this question

You can use the following code to get the most recent post by a given Author, just un-comment one of the two lines as appropriate. See the Codex for more info on WP_Query.

The Codex entry is pretty long, so scroll down to the Parameters section for more info on the various options you can filter your query with.

$query = new WP_Query(array(

    // get most recent post by Author's nickname (not username!)
//    'author_name'    => 'Joe'

    // get most recent post by Author's ID
//    'author'         => 7,

    'posts_per_page' => 1,
share|improve this answer
Getting author's post is easy....but what I want is completely different. Let me clarify my question again: I am showing employee's profile in my site via custom post type. So when I am viewing an employees profile page (which is not via author.php), I want to show the latest post written by him....assuming that employee is an author on the site. – Ajay M Feb 5 '13 at 7:19
@AjayM, please, add details to the Question itself. As you can see, it was already misinterpreted... Myself, I inderstood you were talking about /wp-admin/profile.php. Show your code, template name, etc. – brasofilo Feb 5 '13 at 19:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.