WordPress.org

Make WordPress Core

Ticket #28037: 28037.2.patch

File 28037.2.patch, 882 bytes (added by azaozz, 5 years ago)
  • src/wp-admin/includes/misc.php

     
    826826}
    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' );