diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index d6786e98c4..5173daf32c 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -661,9 +661,10 @@ class WP_Posts_List_Table extends WP_List_Table { if ( $post_type_object->public ) { if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { if ( $can_edit_post ) { - + $preview_link = set_url_scheme( get_permalink( $post->ID ) ); /** This filter is documented in wp-admin/includes/meta-boxes.php */ - $actions['view'] = '' . __( 'Preview' ) . ''; + $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); + $actions['view'] = '' . __( 'Preview' ) . ''; } } elseif ( 'trash' != $post->post_status ) { $actions['view'] = '' . __( 'View' ) . ''; diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index b5bc75be2f..5a4d57e0c1 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -47,9 +47,10 @@ if ( 'publish' == $post->post_status ) { * * @since 2.0.5 * - * @param string $preview_link URI the user will be directed to for a post preview. + * @param string $preview_link URI the user will be directed to for a post preview. + * @param WP_Post $post Post object. */ - $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) ); + $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) ); $preview_button = __( 'Preview' ); } ?> diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 7f6bda4207..dba84a22cf 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1220,7 +1220,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { if( 'draft' == $post->post_status ) { $preview_link = set_url_scheme( get_permalink( $post->ID ) ); /** This filter is documented in wp-admin/includes/meta-boxes.php */ - $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ); + $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); $return .= "$view_post\n"; } else { $return .= "$view_post\n"; @@ -1404,7 +1404,7 @@ function _admin_notice_post_locked() { } /** This filter is documented in wp-admin/includes/meta-boxes.php */ - $preview_link = apply_filters( 'preview_post_link', $preview_link ); + $preview_link = apply_filters( 'preview_post_link', $preview_link, $post ); /** * Filter whether to allow the post lock to be overridden. @@ -1606,7 +1606,7 @@ function post_preview() { $url = add_query_arg( $query_args, get_permalink( $post->ID ) ); /** This filter is documented in wp-admin/includes/meta-boxes.php */ - return apply_filters( 'preview_post_link', $url ); + return apply_filters( 'preview_post_link', $url, $post ); } /** diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 4215822fd9..9e4c115a31 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -496,7 +496,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) { if( 'draft' == $post->post_status ) { $preview_link = set_url_scheme( get_permalink( $post->ID ) ); /** This filter is documented in wp-admin/includes/meta-boxes.php */ - $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ); + $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); $wp_admin_bar->add_menu( array( 'id' => 'preview', 'title' => __( 'Preview' ),