0

So I have ten authors on my site, and I want to designate a section where it shows the ten authors and their 5 latest posts in the form of the post title linking to the post.

I tried using the following

<?php get_most_recent_post_of_user( $user_id ); ?>

But it doesn't work, so I'm feeling a bit lost.

Any advice/suggestion?

1

The function you are using, get_most_recent_post_of_user, won't work as it only retrieves the latest post from the author. It cannot retieve a list of posts

Walks through each of a user's blogs to find the post with the most recent post_date_gmt.

You will most probably be better of using either WP_Query or get_posts to achieve this.

You should first add all your author ID's in an array or use a custom function to dynamically get them, and then use a foreach loop and loop through all the separate ID`s and using each ID in a custom query to retrieve the latest 5 posts from that author

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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