Skip to content

Instantly share code, notes, and snippets.

@nicomollet
Created July 26, 2018 15:03
Show Gist options
  • Save nicomollet/955275fcb2aaf3c39c208f25cdf620be to your computer and use it in GitHub Desktop.
Save nicomollet/955275fcb2aaf3c39c208f25cdf620be to your computer and use it in GitHub Desktop.
ACF Disable Autocomplete on input and textarea fields
<?php
/**
* ACF Disable Autocomplete on input and textarea fields
* Chrome ignores autocomplete="off" in some cases
*
* @author Nicolas Mollet
* @link https://bugs.chromium.org/p/chromium/issues/detail?id=468153
*/
function acf_input_disable_autocomplete() {
?>
<script type="text/javascript">
(function($) {
$('.acf-input-wrap input, .acf-input textarea').attr('autocomplete', 'disableacf'); // use a random string other than off to disable it completely
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'acf_input_disable_autocomplete');
@haveigonemental
Copy link

Just change the 'disableacf' to 'new-password' and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment