Title: Disable the javascript function wp_attempt_focus() in wp-login
Last modified: August 21, 2016

---

# Disable the javascript function wp_attempt_focus() in wp-login

 *  Resolved [Reuven.g](https://wordpress.org/support/users/reuveng/)
 * (@reuveng)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/disable-the-javascript-function-wp_attempt_focus-in-wp-login/)
 * Near the end of the wp-login.php file there is a definition of a javascript function`
   wp_attempt_focus()` which do autofocus on on the inputs on a timeout.
    I want
   to disable it and prevent it from firing. Is there any possible way to do so 
   without changing the wp-login.php file? I have tried adding javascript to the
   login_footer action hook, setting the inputs to blur. It removes the focus on
   the input but it is done after focusing on the input, which I want to prevent
   from happening. Is there a way to do this without deleting the function from 
   the wp-ogin.php file?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Robbert S](https://wordpress.org/support/users/robbert-s/)
 * (@robbert-s)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/disable-the-javascript-function-wp_attempt_focus-in-wp-login/#post-4786644)
 * There are a few ways around it. Check out my post on the WordPress SE: [http://wordpress.stackexchange.com/questions/163524/password-field-is-empty-error-when-using-autofill-in-chrome/](http://wordpress.stackexchange.com/questions/163524/password-field-is-empty-error-when-using-autofill-in-chrome/)
 *  Thread Starter [Reuven.g](https://wordpress.org/support/users/reuveng/)
 * (@reuveng)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/disable-the-javascript-function-wp_attempt_focus-in-wp-login/#post-4786645)
 * Thank you [@robbert](https://wordpress.org/support/users/robbert/),
    I had to
   change the hackish fix to make it work for me. function kill_wp_attempt_focus_replace(
   $html) { return preg_replace(‘/function wp_attempt_focus/’,’function wp_attempt_focus(){}
   function wp_attempt_focus_killed’,$html); } I changed the preg_replace.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Disable the javascript function wp_attempt_focus() in wp-login’ is closed
to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Reuven.g](https://wordpress.org/support/users/reuveng/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/disable-the-javascript-function-wp_attempt_focus-in-wp-login/#post-4786645)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
