Prevent default post formats from entering the DB. see #15629 #15582

git-svn-id: https://develop.svn.wordpress.org/trunk@16662 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-12-01 20:03:39 +00:00
parent 24471799a5
commit a7d80782f2
1 changed files with 8 additions and 2 deletions

View File

@ -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');
} }