Make WordPress Core

Ticket #15805: 15805.diff

File 15805.diff, 773 bytes (added by songsthatsaved, 12 years ago)

Updated patch for 3.6

  • post.php

     
    34653465function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ) {
    34663466        global $wpdb;
    34673467        $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) );
     3468        $cache_id = "page_title_$page_title";
     3469                 
     3470        if( false === $page = wp_cache_get( $cache_id, 'posts' ) ) {
     3471                $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) );
     3472                wp_cache_add( $cache_id, $page, 'posts' );
     3473}
    34683474        if ( $page )
    34693475                return get_post( $page, $output );
    34703476