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 am using WordPress 3.4.2. The codex doesn't say anything about this function being depreciated: http://codex.wordpress.org/Function_Reference/get_most_recent_post_of_user

share|improve this question
Are you using multisite? – Chris_O Sep 29 '12 at 23:09
No, I am not using multisite. – rg89 Sep 29 '12 at 23:10
deprecated, rather than depreciated :) – Ivan Sep 30 '12 at 1:44
I've just added to the Codex that it only works on Multisite :) – Tim Malone Jun 23 at 20:04
up vote 3 down vote accepted

get_most_recent_post_of_user() is for multisite installs to get the most recent post of the user from each blog.

Here is a comparable function you can use that will return the post object of the defined users most recent post.

function wpse_get_user_recent( $user ) {
    global $wpdb;

    $recent  = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", (int)$user ), ARRAY_A);

        if( ! isset( $recent['ID'] ) )
            return new WP_Error( 'No post found for selected user' );

    return get_post( $recent['ID'], 'ARRAY_A' );



$post = wpse_get_user_recent( 36 );
setup_post_data( $post );

share|improve this answer

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.