Allow deleting a format. see #14746

git-svn-id: http://svn.automattic.com/wordpress/trunk@15779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-10-12 19:43:54 +00:00
parent d753847050
commit d082fbbb4f
1 changed files with 4 additions and 3 deletions

View File

@ -510,7 +510,7 @@ function has_post_format( $format, $post = null ) {
* Assign a format to a post
*
* @param int|object $post The post for which to assign a format
* @param string $format A format to assign.
* @param string $format A format to assign. Use an empty string or array to remove all formats from the post.
* @return mixed WP_Error on error. Array of affected term IDs on success.
*/
function set_post_format( $post, $format ) {
@ -519,9 +519,10 @@ function set_post_format( $post, $format ) {
if ( empty($post) )
return new WP_Error('invalid_post', __('Invalid post'));
$format = sanitize_key($format);
if ( !empty($format) )
$format = 'post-format-' . sanitize_key($format);
return wp_set_post_terms($post->ID, array('post-format-' . $format), 'post_format');
return wp_set_post_terms($post->ID, $format, 'post_format');
}
/**