mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 07:22:01 +01:00
git-svn-id: http://svn.automattic.com/wordpress/trunk@16662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fab93cc99f
commit
1b72cb22a4
@ -526,8 +526,14 @@ function set_post_format( $post, $format ) {
|
||||
if ( empty($post) )
|
||||
return new WP_Error('invalid_post', __('Invalid post'));
|
||||
|
||||
if ( !empty($format) )
|
||||
$format = 'post-format-' . sanitize_key($format);
|
||||
if ( !empty($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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user