WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/27/2013 01:02:10 AM (8 years ago)
Author:
SergeyBiryukov
Message:

Fix switching post formats when JavaScript is disabled. props kovshenin. see #24360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r24264 r24373  
    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';
    141 
    142         if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
    143             $post_format = $_REQUEST['format'];
    144     }
    145144
    146145    $format_class = " class='wp-format-{$post_format}'";
     
    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
Note: See TracChangeset for help on using the changeset viewer.