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.

git-svn-id: https://develop.svn.wordpress.org/trunk@29448 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-08-08 20:53:31 +00:00
parent d837ad9fa3
commit 78c928ad44
1 changed files with 17 additions and 0 deletions

View File

@ -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' );