WordPress.org

Make WordPress Core

Ticket #33068: 33068-2.patch

File 33068-2.patch, 1.1 KB (added by Rahe, 4 years ago)
  • wp-includes/post-functions.php

    diff --git i/wp-includes/post-functions.php w/wp-includes/post-functions.php
    index fdd01ee..8fc5843 100644
    i w function get_extended( $post ) { 
    425425 *                            When $output is OBJECT, a `WP_Post` instance is returned.
    426426 */
    427427function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
    428         if ( empty( $post ) && isset( $GLOBALS['post'] ) )
     428        if ( 0 !== $post && empty( $post ) && isset( $GLOBALS['post'] ) ) {
    429429                $post = $GLOBALS['post'];
     430        }
    430431
    431432        if ( $post instanceof WP_Post ) {
    432433                $_post = $post;
    function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { 
    443444                $_post = WP_Post::get_instance( $post );
    444445        }
    445446
    446         if ( ! $_post )
     447        if ( ! $_post ) {
    447448                return null;
     449        }
    448450
    449451        $_post = $_post->filter( $filter );
    450452
    451         if ( $output == ARRAY_A )
     453        if ( $output == ARRAY_A ) {
    452454                return $_post->to_array();
    453         elseif ( $output == ARRAY_N )
     455        } elseif ( $output == ARRAY_N ) {
    454456                return array_values( $_post->to_array() );
     457        }
    455458
    456459        return $_post;
    457460}