From 53a3137e1a39398ae7175623204ba85b093bd89f Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 19 Jun 2015 21:48:11 +0000 Subject: [PATCH] Edit Post screen messages need to run preview URLs through the `preview_post_link` filter. Props pareshradadiya. Fixes #32191. git-svn-id: https://develop.svn.wordpress.org/trunk@32870 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-advanced.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index 0724a88c71..c93112b49a 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -81,6 +81,9 @@ if ( ! $permalink ) { } $messages = array(); +/** This filter is documented in wp-admin/includes/meta-boxes.php */ +$post_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post ); + $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __('Post updated. View post'), esc_url( $permalink ) ), @@ -91,12 +94,16 @@ $messages['post'] = array( 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('Post published. View post'), esc_url( $permalink ) ), 7 => __('Post saved.'), - 8 => sprintf( __('Post submitted. Preview post'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + 8 => sprintf( __('Post submitted. Preview post'), esc_url( $post_preview_url ) ), 9 => sprintf( __('Post scheduled for: %1$s. Preview post'), /* translators: Publish box date format, see http://php.net/date */ date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ), - 10 => sprintf( __('Post draft updated. Preview post'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + 10 => sprintf( __('Post draft updated. Preview post'), esc_url( $post_preview_url ) ), ); + +/** This filter is documented in wp-admin/includes/meta-boxes.php */ +$page_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post ); + $messages['page'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __('Page updated. View page'), esc_url( $permalink ) ), @@ -106,9 +113,9 @@ $messages['page'] = array( 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('Page published. View page'), esc_url( $permalink ) ), 7 => __('Page saved.'), - 8 => sprintf( __('Page submitted. Preview page'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + 8 => sprintf( __('Page submitted. Preview page'), esc_url( $page_preview_url ) ), 9 => sprintf( __('Page scheduled for: %1$s. Preview page'), date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ), - 10 => sprintf( __('Page draft updated. Preview page'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + 10 => sprintf( __('Page draft updated. Preview page'), esc_url( $page_preview_url ) ), ); $messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.