| 1 | Index: wp-includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post.php (revision 23307) |
|---|
| 4 | +++ wp-includes/post.php (working copy) |
|---|
| 5 | @@ -758,13 +758,16 @@ |
|---|
| 6 | * |
|---|
| 7 | * @since 3.1.0 |
|---|
| 8 | * |
|---|
| 9 | - * @param int|object $post A post |
|---|
| 10 | + * @param int|object $post Post ID or post object. Optional, default is the current post from the loop. |
|---|
| 11 | * |
|---|
| 12 | * @return mixed The format if successful. False if no format is set. WP_Error if errors. |
|---|
| 13 | */ |
|---|
| 14 | function get_post_format( $post = null ) { |
|---|
| 15 | - $post = get_post($post); |
|---|
| 16 | + $post = get_post( $post ); |
|---|
| 17 | |
|---|
| 18 | + if ( empty( $post ) ) |
|---|
| 19 | + return new WP_Error( 'invalid_post', __( 'Invalid post' ) ); |
|---|
| 20 | + |
|---|
| 21 | if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) |
|---|
| 22 | return false; |
|---|
| 23 | |
|---|