mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 01:52:24 +01:00
Return false in get_post_format() if the post does not exist.
props adamsilverstein, ericlewis. fixes #23255. git-svn-id: https://develop.svn.wordpress.org/trunk@24057 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4d584800bf
commit
a67bb694c5
@ -11,12 +11,12 @@
|
|||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*
|
*
|
||||||
* @param int|object $post A post.
|
* @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
|
||||||
*
|
* @return mixed The format if successful. False otherwise.
|
||||||
* @return mixed The format if successful. False if no format is set. WP_Error if errors.
|
|
||||||
*/
|
*/
|
||||||
function get_post_format( $post = null ) {
|
function get_post_format( $post = null ) {
|
||||||
$post = get_post($post);
|
if ( ! $post = get_post( $post ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
|
if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
|
||||||
return false;
|
return false;
|
||||||
@ -28,7 +28,7 @@ function get_post_format( $post = null ) {
|
|||||||
|
|
||||||
$format = array_shift( $_format );
|
$format = array_shift( $_format );
|
||||||
|
|
||||||
return ( str_replace('post-format-', '', $format->slug ) );
|
return str_replace('post-format-', '', $format->slug );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user