get_most_recent_post_of_user

Advertisement

Summery Summery

Get a user’s most recent post.

Syntax Syntax

get_most_recent_post_of_user( int $user_id )

Description Description

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

Parameters Parameters

$user_id

(int) (Required)

Return Return

(array) Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts

Source Source

File: wp-includes/ms-functions.php

 * properties of the network being viewed.
 *
 * @see wpmu_current_site()
 *
 * @since MU (3.0.0)
 *
 * @global WP_Network $current_site
 *
 * @return WP_Network
 */
function get_current_site() {
	global $current_site;
	return $current_site;
}

/**
 * Get a user's most recent post.
 *
 * Walks through each of a user's blogs to find the post with
 * the most recent post_date_gmt.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $user_id
 * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
 */
function get_most_recent_post_of_user( $user_id ) {
	global $wpdb;

	$user_blogs       = get_blogs_of_user( (int) $user_id );
	$most_recent_post = array();

Advertisement

Changelog Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

What are you looking for?