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

git-svn-id: http://svn.automattic.com/wordpress/trunk@16662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-01 20:03:39 +00:00
parent fab93cc99f
commit 1b72cb22a4
1 changed files with 8 additions and 2 deletions

View File

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