This has bothered me too, especially in Chrome, because most places you would a password field are not something that would autofill for the site (login, etc). Chrome will automatically try to fill in the password, which removes the existing value. This creates a situation where you can’t save the existing password without disabling autofill in the browser.
To overcome this, here is a quick patch you can put in your functions.php
file.
add_action( 'acf/render_field/type=password', function(){
ob_start();
}, 8);
add_action( 'acf/render_field/type=password', function(){
return str_replace( '<input ', '<input autocomplete="new-password" ', ob_get_clean() );
}, 10);
I think this attribute should be part of the core password field to avoid the situation described above as it is one that I run into with a lot of my clients.
-Mark
Sounds good – thanks @hube2.
I just wrote a plugin to solve some of this without hacking the core. Please see:
https://github.com/owlwatch/acf-multisite-options
This allows you to create network options pages with the same ACF API, you just need to add a network
attribute to the options when using acf_add_options_page
or acf_add_options_sub_page
. For example:
acf_add_options_page([
'network' => true,
'post_id' => 'acf_network_options',
'page_title' => 'Network Options',
'menu_title' => 'Network Options'
]);
I’m not sure what happened to my reply on this thread, so pardon me if this is a duplicate post.
The values are stored in the ‘sitemeta’ table, so they are accessible across sites without needing to use the switch_to_blog function.
@elliot – There is a lot of extra code that could be reduced if there were a filters in place in the acf_get_metadata
, acf_update_metadata
and acf_delete_metadata
functions. Alternatively, this functionality could be built into the core fairly easily. If you are interested, I could create a pull request, but I would need to do so in the Pro repo.
Hope this helps some people. I am using in a production site now and will make this plugin available on the WordPress directory once I’ve tested a bit more.
I just wrote a plugin to solve some of this without hacking the core. Please see:
https://github.com/owlwatch/acf-multisite-options
This allows you to create network options pages with the same ACF API, you just need to add a network
attribute to the options when using acf_add_options_page
or acf_add_options_sub_page
. For example:
acf_add_options_page([
'network' => true,
'post_id' => 'acf_network_options',
'page_title' => 'Network Options',
'menu_title' => 'Network Options'
]);
The values are stored in the ‘sitemeta’ table, so they are accessible across sites without needing to use the switch_to_blog function.
@elliot – There is a lot of extra code that could be reduced if there were a filters in place in the acf_get_metadata
, acf_update_metadata
and acf_delete_metadata
functions. Alternatively, this functionality could be built into the core fairly easily. If you are interested, I could create a pull request, but I would need to do so in the Pro repo.
Hope this helps some people. I am using in a production site now and will make this plugin available on the WordPress directory once I’ve tested a bit more.
I decided I needed to get this working so I wrote a plugin to get the ball rolling.
https://gist.github.com/fabrizim/9c0f36365f20705f7f73
This plugin alters the storage of values for widgets to be more in line with how widget settings are natively stored. This allows for the customizer to work with ACF fields.
I’m still testing, but it seems to be working. Elliot- let me know if you have a chance to review and if you think this approach will work.
Hi Elliot-
Just following up on this. Are there plans to make ACF work with the Customizer? I’d love to use ACF for managing widget fields, but if it does not work in the Customizer, it may be too confusing for my clients.
Thanks for the great plugin-
Mark
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.