Skip to content

Commit

Permalink
Editor: use the post_edit_form_tag action to add autocomplete="off"…
Browse files Browse the repository at this point in the history
… 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.

Built from https://develop.svn.wordpress.org/trunk@29448


git-svn-id: http://core.svn.wordpress.org/trunk@29226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed Aug 8, 2014
1 parent 2353c35 commit 4deee32
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions wp-admin/includes/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,20 @@ function heartbeat_autosave( $response, $data ) {
}
// Run later as we have to set DOING_AUTOSAVE for back-compat
add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );

/**
* Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
* as they disregard the autocomplete setting on the editor textarea. That can break the editor
* when the user navigates to it with the browser's Back button. See #28037
*
* @since 4.0
*/
function post_form_autocomplete_off() {
global $is_safari, $is_chrome;

if ( $is_safari || $is_chrome ) {
echo ' autocomplete="off"';
}
}

add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' );

0 comments on commit 4deee32

Please sign in to comment.