diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index b434ae52e4..3f6260e586 100644
|
a
|
b
|
function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
|
| 5757 | 5757 | * |
| 5758 | 5758 | * @global wpdb $wpdb WordPress database abstraction object. |
| 5759 | 5759 | * |
| 5760 | | * @param string $page_title Page title. |
| 5761 | | * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which |
| 5762 | | * correspond to a WP_Post object, an associative array, or a numeric array, |
| 5763 | | * respectively. Default OBJECT. |
| 5764 | | * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. |
| | 5760 | * @param string $page_title Page title. |
| | 5761 | * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which |
| | 5762 | * correspond to a WP_Post object, an associative array, or a numeric array, |
| | 5763 | * respectively. Default OBJECT. |
| | 5764 | * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. |
| | 5765 | * @param string|array $post_status Optional. Post status or array of post statuses. Default 'publish'. |
| 5765 | 5766 | * @return WP_Post|array|null WP_Post (or array) on success, or null on failure. |
| 5766 | 5767 | */ |
| 5767 | | function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { |
| | 5768 | function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page', $post_status = 'publish' ) { |
| 5768 | 5769 | global $wpdb; |
| 5769 | 5770 | |
| 5770 | 5771 | if ( is_array( $post_type ) ) { |
| … |
… |
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' )
|
| 5792 | 5793 | ); |
| 5793 | 5794 | } |
| 5794 | 5795 | |
| | 5796 | if ( is_array( $post_status ) ) { |
| | 5797 | $post_status = esc_sql( $post_status ); |
| | 5798 | $post_status_in_string = "'" . implode( "','", $post_status ) . "'"; |
| | 5799 | |
| | 5800 | $sql .= $wpdb->prepare( " AND post_status IN ($post_status_in_string)", null ); |
| | 5801 | } else { |
| | 5802 | $sql .= $wpdb->prepare( " AND post_status = %s", $post_status ); |
| | 5803 | } |
| | 5804 | |
| 5795 | 5805 | $page = $wpdb->get_var( $sql ); |
| 5796 | 5806 | |
| 5797 | 5807 | if ( $page ) { |