WordPress.org

Make WordPress Core

Ticket #24360: 24360.diff

File 24360.diff, 2.3 KB (added by kovshenin, 5 years ago)
  • wp-admin/admin-header.php

     
    8787
    8888if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_type(), 'post-formats' ) ) {
    8989        $post_format = get_post_format();
    90         if ( ! $post_format ) {
     90
     91        if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
     92                $post_format = $_REQUEST['format'];
     93
     94        if ( ! $post_format )
    9195                $post_format = 'standard';
    9296
    93                 if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
    94                         $post_format = $_REQUEST['format'];
    95         }
    96 
    9797        $admin_body_class .= ' wp-format-' . $post_format;
    9898
    9999        $show_post_format_ui = false;
  • wp-admin/edit-form-advanced.php

     
    136136        wp_enqueue_style( 'wp-mediaelement' );
    137137        $post_format = get_post_format();
    138138
    139         if ( ! $post_format ) {
     139        if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
     140                $post_format = $_REQUEST['format'];
     141
     142        if ( ! $post_format )
    140143                $post_format = 'standard';
    141144
    142                 if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
    143                         $post_format = $_REQUEST['format'];
    144         }
    145 
    146145        $format_class = " class='wp-format-{$post_format}'";
    147146
    148147        $all_post_formats = array(
     
    185184                        $active_post_type_slug = $slug;
    186185                }
    187186
    188                 $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( $slug ) . '"><div class="' . $slug . '"></div><span class="post-format-title">' . ucfirst( $slug ) . '</span></a>';
     187                $url = add_query_arg( 'format', $slug );
     188
     189                $post_format_options .= '<a ' . $class . ' href="' . esc_url( $url ) . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( $slug ) . '"><div class="' . $slug . '"></div><span class="post-format-title">' . ucfirst( $slug ) . '</span></a>';
    189190        }
    190191
    191192        $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) );