Ticket #15805: 15805.1.patch
File 15805.1.patch, 1.0 KB (added by , 12 years ago) |
---|
-
src/wp-includes/post.php
3484 3484 * @param string $post_type Optional. Post type. Default page. 3485 3485 * @return WP_Post|null WP_Post on success or null on failure 3486 3486 */ 3487 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {3487 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { 3488 3488 global $wpdb; 3489 $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) ); 3489 3490 $cache_id = 'page_title_' . $page_title . $post_type; 3491 3492 if ( false === $page = wp_cache_get( $cache_id, 'posts' ) ) { 3493 $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) ); 3494 wp_cache_add( $cache_id, $page, 'posts' ); 3495 } 3496 3490 3497 if ( $page ) 3491 3498 return get_post( $page, $output ); 3492 3499