Home › Forums › Feature Requests › Support Multisite options for all sites through sitemeta table › Reply To: Support Multisite options for all sites through sitemeta table
I have managed to accomplish network-level settings with some filters:
// When loading the value for the "Foo" field, get it from the sitemeta table:
add_filter( "acf/load_value/key=foo", function () use ( $field_key ) {
$value = get_site_option( $field_key );
if ( $value !== false ) {
return $value;
}
return '';
} );
// When setting the value for the "Foo" field, set it to sitemeta table:
add_filter( "acf/update_value/key=foo", function ( $value ) use ( $field_key ) {
return add_site_option( $field_key, $value );
} );
Result: Updating the field “Foo” in any of the network sites applies it to all of the network sites.
It’s up to the developer, though, to make sure that these fields are assigned to an Options page which has the super-admin
permission callback.
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.