Advertisements

get_blog_post

Definition:
function get_blog_post( $blog_id, $post_id ) {}

Get a blog post from any site on the network.

Parameters

  • int $blog_id: ID of the blog.
  • int $post_id: ID of the post you’re looking for.

Return values

returns:post.

Source code

function get_blog_post( $blog_id, $post_id ) {

	global $wpdb;



	$key = $blog_id . '-' . $post_id;

	$post = wp_cache_get( $key, 'global-posts' );

	if ( $post == false ) {

		$post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) );

		wp_cache_add( $key, $post, 'global-posts' );

	}



	return $post;

}

1218

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: