Only set default post format on new posts – not old ones. props nacin. fixes #15882

git-svn-id: http://svn.automattic.com/wordpress/trunk@17062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2010-12-19 19:22:31 +00:00
parent 93607280e6
commit 3469500927
2 changed files with 3 additions and 1 deletions

View File

@ -247,7 +247,7 @@ function post_format_meta_box( $post, $box ) {
if ( is_array( $post_formats[0] ) ) : if ( is_array( $post_formats[0] ) ) :
$post_format = get_post_format( $post->ID ); $post_format = get_post_format( $post->ID );
if ( !$post_format ) if ( !$post_format )
$post_format = get_option('default_post_format', '0'); $post_format = '0';
$post_format_display = get_post_format_string( $post_format ); $post_format_display = get_post_format_string( $post_format );
// Add in the current one if it isn't there yet, in case the current theme doesn't support it // Add in the current one if it isn't there yet, in case the current theme doesn't support it
if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) if ( $post_format && !in_array( $post_format, $post_formats[0] ) )

View File

@ -391,6 +391,8 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
wp_delete_post( $delete, true ); // Force delete wp_delete_post( $delete, true ); // Force delete
$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ); $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
$post = get_post( $post_id ); $post = get_post( $post_id );
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) )
set_post_format( $post, get_option( 'default_post_format' ) );
} else { } else {
$post->ID = 0; $post->ID = 0;
$post->post_author = ''; $post->post_author = '';