mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Preview for both drafts and published posts/pages
git-svn-id: https://develop.svn.wordpress.org/trunk@9451 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3551,3 +3551,25 @@ function wp_get_post_revisions( $post_id = 0, $args = null ) {
|
||||
return array();
|
||||
return $revisions;
|
||||
}
|
||||
|
||||
function _show_post_preview() {
|
||||
|
||||
if ( isset($_GET['wp_preview']) && isset($_GET['preview_nonce']) ) {
|
||||
$post_ID = (int) $_GET['wp_preview'];
|
||||
|
||||
if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $post_ID ) )
|
||||
wp_die( __('You do not have permission to preview drafts.') );
|
||||
|
||||
$q = array(
|
||||
'name' => "{$post_ID}-autosave",
|
||||
'post_parent' => $post_ID,
|
||||
'post_type' => 'revision',
|
||||
'post_status' => 'inherit'
|
||||
);
|
||||
|
||||
add_action( 'parse_query', '_wp_get_post_autosave_hack' );
|
||||
query_posts($q);
|
||||
remove_action( 'parse_query', '_wp_get_post_autosave_hack' );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user