Restore post format previewing.
props azaozz. fixes #24483 git-svn-id: http://core.svn.wordpress.org/trunk@24414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -444,6 +444,8 @@ function _set_preview($post) {
|
||||
$post->post_title = $preview->post_title;
|
||||
$post->post_excerpt = $preview->post_excerpt;
|
||||
|
||||
add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
@@ -465,6 +467,27 @@ function _show_post_preview() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters terms lookup to set the post format.
|
||||
*
|
||||
* @since 3.6.0
|
||||
* @access private
|
||||
*/
|
||||
function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
|
||||
if ( ! $post = get_post() )
|
||||
return $terms;
|
||||
|
||||
if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
|
||||
return $terms;
|
||||
|
||||
if ( 'standard' == $_REQUEST['post_format'] )
|
||||
$terms = array();
|
||||
elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
|
||||
$terms = array( $term ); // Can only have one post format
|
||||
|
||||
return $terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the post revision version.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user