Make WordPress Core

Changeset 29448


Ignore:
Timestamp:
08/08/2014 08:53:31 PM (11 years ago)
Author:
azaozz
Message:

Editor: use the post_edit_form_tag action to add autocomplete="off" to the whole form on the Add/Edit Post screen in WebKit. Prevents editor problems when the browser's Back button is used. Fixes #28037.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r29206 r29448  
    827827// Run later as we have to set DOING_AUTOSAVE for back-compat
    828828add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );
     829
     830/**
     831 * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
     832 * as they disregard the autocomplete setting on the editor textarea. That can break the editor
     833 * when the user navigates to it with the browser's Back button. See #28037
     834 *
     835 * @since 4.0
     836 */
     837function post_form_autocomplete_off() {
     838    global $is_safari, $is_chrome;
     839
     840    if ( $is_safari || $is_chrome ) {
     841        echo ' autocomplete="off"';
     842    }
     843}
     844
     845add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' );
Note: See TracChangeset for help on using the changeset viewer.