Make WordPress Core

Ticket #21595: ms-functions.diff

File ms-functions.diff, 734 bytes (added by jondavidjohn, 13 years ago)
  • wp-includes/ms-functions.php

     
    155155 * @return object The post.
    156156 */
    157157function get_blog_post( $blog_id, $post_id ) {
    158         global $wpdb;
    159 
    160158        $key = $blog_id . '-' . $post_id;
    161159        $post = wp_cache_get( $key, 'global-posts' );
    162160        if ( $post == false ) {
    163                 $post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) );
     161                switch_to_blog( $blog_id );
     162                $post = get_post($post_id);
     163                restore_current_blog();
    164164                wp_cache_add( $key, $post, 'global-posts' );
    165165        }
    166 
    167166        return $post;
    168167}
    169168