git-svn-id: https://develop.svn.wordpress.org/trunk@16662 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
24471799a5
commit
a7d80782f2
|
@ -526,8 +526,14 @@ function set_post_format( $post, $format ) {
|
||||||
if ( empty($post) )
|
if ( empty($post) )
|
||||||
return new WP_Error('invalid_post', __('Invalid post'));
|
return new WP_Error('invalid_post', __('Invalid post'));
|
||||||
|
|
||||||
if ( !empty($format) )
|
if ( !empty($format) ) {
|
||||||
$format = 'post-format-' . sanitize_key($format);
|
$format = sanitize_key($format);
|
||||||
|
$empty_formats = array( 'post', 'default' );
|
||||||
|
if ( in_array( $format, $empty_formats ) )
|
||||||
|
$format = '';
|
||||||
|
else
|
||||||
|
$format = 'post-format-' . $format;
|
||||||
|
}
|
||||||
|
|
||||||
return wp_set_post_terms($post->ID, $format, 'post_format');
|
return wp_set_post_terms($post->ID, $format, 'post_format');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue