Create a function, get_preview_post_link(), to DRY the logic for applying the 'preview_post_link' filter to a URL.

Props TomHarrigan, wonderboymusic.
Fixes #24345.


git-svn-id: https://develop.svn.wordpress.org/trunk@34170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-15 04:14:23 +00:00
parent ac610c191b
commit c0d850878a
8 changed files with 61 additions and 44 deletions
+2 -4
View File
@@ -81,8 +81,7 @@ 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 );
$post_preview_url = get_preview_post_link( $post );
$preview_link_html = $scheduled_link_html = $view_post_html = '';
@@ -125,8 +124,7 @@ $messages['post'] = array(
10 => __( 'Post draft updated.' ) . $preview_link_html,
);
/** 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 );
$page_preview_url = get_preview_post_link( $post );
$messages['page'] = array(
0 => '', // Unused. Messages start at index 1.