Make WordPress Core

Changeset 28969


Ignore:
Timestamp:
07/03/2014 02:41:06 PM (10 years ago)
Author:
SergeyBiryukov
Message:

Pass $post object to 'preview_post_link' filter.

props danielbachhuber.
fixes #28729.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r28916 r28969  
    662662                    if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    663663                        if ( $can_edit_post ) {
    664 
     664                            $preview_link = set_url_scheme( get_permalink( $post->ID ) );
    665665                            /** This filter is documented in wp-admin/includes/meta-boxes.php */
    666                             $actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
     666                            $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
     667                            $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    667668                        }
    668669                    } elseif ( 'trash' != $post->post_status ) {
  • trunk/src/wp-admin/includes/meta-boxes.php

    r28539 r28969  
    4848     * @since 2.0.5
    4949     *
    50      * @param string $preview_link URI the user will be directed to for a post preview.
     50     * @param string  $preview_link URI the user will be directed to for a post preview.
     51     * @param WP_Post $post         Post object.
    5152     */
    52     $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) );
     53    $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) );
    5354    $preview_button = __( 'Preview' );
    5455}
  • trunk/src/wp-admin/includes/post.php

    r28948 r28969  
    12211221            $preview_link = set_url_scheme( get_permalink( $post->ID ) );
    12221222            /** This filter is documented in wp-admin/includes/meta-boxes.php */
    1223             $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) );
     1223            $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
    12241224            $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n";
    12251225        } else {
     
    14051405
    14061406        /** This filter is documented in wp-admin/includes/meta-boxes.php */
    1407         $preview_link = apply_filters( 'preview_post_link', $preview_link );
     1407        $preview_link = apply_filters( 'preview_post_link', $preview_link, $post );
    14081408
    14091409        /**
     
    16071607
    16081608    /** This filter is documented in wp-admin/includes/meta-boxes.php */
    1609     return apply_filters( 'preview_post_link', $url );
     1609    return apply_filters( 'preview_post_link', $url, $post );
    16101610}
    16111611
  • trunk/src/wp-includes/admin-bar.php

    r28920 r28969  
    497497                $preview_link = set_url_scheme( get_permalink( $post->ID ) );
    498498                /** This filter is documented in wp-admin/includes/meta-boxes.php */
    499                 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) );
     499                $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
    500500                $wp_admin_bar->add_menu( array(
    501501                    'id' => 'preview',
Note: See TracChangeset for help on using the changeset viewer.