WordPress.org

Make WordPress Core

Ticket #21595: 21595.diff

File 21595.diff, 1.6 KB (added by ryan, 6 years ago)
  • wp-includes/ms-functions.php

     
    152152 *
    153153 * @param int $blog_id ID of the blog.
    154154 * @param int $post_id ID of the post you're looking for.
    155  * @return object The post.
     155 * @return WP_Post The post.
    156156 */
    157157function get_blog_post( $blog_id, $post_id ) {
    158         global $wpdb;
     158        switch_to_blog( $blog_id );
     159        $post = get_post( $post_id );
     160        restore_current_blog();
    159161
    160         $key = $blog_id . '-' . $post_id;
    161         $post = wp_cache_get( $key, 'global-posts' );
    162         if ( $post == false ) {
    163                 $post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) );
    164                 wp_cache_add( $key, $post, 'global-posts' );
    165         }
    166 
    167162        return $post;
    168163}
    169164
     
    313308 *
    314309 * @since MU 1.0
    315310 *
    316  * @param int $_blog_id ID of the source blog.
     311 * @param int $blog_id ID of the source blog.
    317312 * @param int $post_id ID of the desired post.
    318313 * @return string The post's permalink
    319314 */
    320 function get_blog_permalink( $_blog_id, $post_id ) {
    321         $key = "{$_blog_id}-{$post_id}-blog_permalink";
    322         $link = wp_cache_get( $key, 'site-options' );
    323         if ( $link == false ) {
    324                 switch_to_blog( $_blog_id );
    325                 $link = get_permalink( $post_id );
    326                 restore_current_blog();
    327                 wp_cache_add( $key, $link, 'site-options', 360 );
    328         }
     315function get_blog_permalink( $blog_id, $post_id ) {
     316        switch_to_blog( $blog_id );
     317        $link = get_permalink( $post_id );
     318        restore_current_blog();
     319
    329320        return $link;
    330321}
    331322