WordPress.org

Make WordPress Core

Ticket #20350: post.diff

File post.diff, 669 bytes (added by wpdavis, 8 years ago)
  • wp-includes/post.php

     
    32063206 */
    32073207function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ) {
    32083208        global $wpdb;
    3209         $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) );
     3209        $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s AND post_status = 'publish'", $page_title, $post_type ) );
    32103210        if ( $page )
    32113211                return get_page($page, $output);
    32123212