I've been searching for a way to sync ACF fields across sites on a WordPress multi-site. There are 5 sites with individual content but they all use the same ACF fields. I'd rather avoid having to manually create and add these new fields on each site.
Is there a workaround?
Using WP 4.8 and ACF Pro 5.5.1.4
Yes, ACF Extended is compatible with WP multisite installations. Note that this plugin is an addon on top of ACF Pro, so of course any Field Groups created using ACF will be working just like before, including with the native ACF local Json feature.
To enable the Json Sync, check the “Json Sync” setting in the targeted field group. Note: By default, if a Json folder has been declared within the theme or the code, ACF Extended will automatically check the “Json Sync” setting on all newly created field groups, in order to stick to the native ACF behavior.
In ACF world, a Field Group is a collection of custom fields that will be displayed together on a WP-Admin editing screen. Behind the scenes, a Field Group is a type of custom post, which means they can be found in the Posts table of your WordPress database.
Since you are using ACF Pro you could make use of the "Export/Import" feature.
You now have ACF fields available network-wide.
I was thinking about this same thing couple of times before and came to conclusion that easiest thing would be to create a github repo with set of acf-field-name.php files and then bring those repos as submodules to each of your projects. If you place this php files in acf folder within your theme folder and use function within functions.php like this
function getAcfFileNames()
{
return array(
'acf-one',
'acf-two',
'acf-three',
);
}
function add_php_acf_field_groups()
{
$fileNames = getAcfFileNames();
foreach ($fileNames as $fileName) {
include_once 'acf/' . $fileName . '.php';
}
}
;
add_action('acf/init', 'add_php_acf_field_groups');
That should work just fine. And if you want to edit those acf.php files within project you can use -> https://github.com/BeAPI/ACF-PHP-Recovery to recover php file locally and update it. After that just export the file and commit it to your ACF repo.
Other then that unfortunately I haven't found better solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With