From 9166734ff5fa889e1c2b4077c77eb01c4a733c27 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 28 Feb 2014 23:08:13 +0000 Subject: [PATCH] Enable previews for all pages of multi-page posts. Fixes #17157. Props solarissmoke, chrisscott Built from https://develop.svn.wordpress.org/trunk@27333 git-svn-id: http://core.svn.wordpress.org/trunk@27185 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 64aee53a79..4aeae5d764 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -714,6 +714,19 @@ function _wp_link_page( $i ) { $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged'); } + if ( is_preview() ) { + $url = add_query_arg( array( + 'preview' => 'true' + ), $url ); + + if ( 'draft' !== $post->post_status ) { + $url = add_query_arg( array( + 'preview_id' => $post->ID, + 'preview_nonce' => wp_create_nonce( 'post_preview_' . $post->ID ) + ), $url ); + } + } + return ''; }