Remove references from get_post() and get_page().
Handle $GLOBALS['post'] containing stdClass instead of WP_Post. Props nacin see #21309 git-svn-id: https://develop.svn.wordpress.org/trunk@21572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4803997d35
commit
83ea8767a5
|
@ -377,12 +377,11 @@ function get_extended($post) {
|
|||
* @param string $filter Optional, default is raw.
|
||||
* @return mixed Post data or null on failure
|
||||
*/
|
||||
function &get_post( &$post, $output = OBJECT, $filter = 'raw' ) {
|
||||
$null = null;
|
||||
function get_post( $post, $output = OBJECT, $filter = 'raw' ) {
|
||||
if ( empty( $post ) && isset( $GLOBALS['post'] ) )
|
||||
$post = $GLOBALS['post'];
|
||||
|
||||
if ( empty( $post ) && isset( $GLOBALS['post'] ) ) {
|
||||
$_post = & $GLOBALS['post'];
|
||||
} elseif ( is_a( $post, 'WP_Post' ) ) {
|
||||
if ( is_a( $post, 'WP_Post' ) ) {
|
||||
$_post = $post;
|
||||
} elseif ( is_object( $post ) ) {
|
||||
if ( empty( $post->filter ) ) {
|
||||
|
@ -399,17 +398,14 @@ function &get_post( &$post, $output = OBJECT, $filter = 'raw' ) {
|
|||
}
|
||||
|
||||
if ( ! $_post )
|
||||
return $null;
|
||||
return null;
|
||||
|
||||
$_post = $_post->filter( $filter );
|
||||
|
||||
if ( $output == ARRAY_A ) {
|
||||
$__post = $_post->to_array();
|
||||
return $__post;
|
||||
} elseif ( $output == ARRAY_N ) {
|
||||
$__post = array_values( $_post->to_array() );
|
||||
return $__post;
|
||||
}
|
||||
if ( $output == ARRAY_A )
|
||||
return $_post->to_array();
|
||||
elseif ( $output == ARRAY_N )
|
||||
return array_values( $_post->to_array() );
|
||||
|
||||
return $_post;
|
||||
}
|
||||
|
@ -3299,9 +3295,8 @@ function get_all_page_ids() {
|
|||
* @param string $filter How the return value should be filtered.
|
||||
* @return mixed Page data.
|
||||
*/
|
||||
function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
|
||||
$p = get_post($page, $output, $filter);
|
||||
return $p;
|
||||
function get_page( $page, $output = OBJECT, $filter = 'raw') {
|
||||
return get_post( $page, $output, $filter );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue