Support

Account

Home Forums ACF PRO Add WP CLI command to sync all ACF Field Groups

Solved

Add WP CLI command to sync all ACF Field Groups

  • Hi there! Opening this thread as a public topic, although it’s actually for the development team of ACF:

    Could you guys add a WP CLI command to sync all ACF field groups to the ACF core? This would come in very handy for automated synchronization between various environmetns. I have build a little plugin that does this, but really think that it would be a very nice feature to have officially supported.

    Here’s a gist of my plugin: https://gist.github.com/hirasso/c48c04def92f839f6264349a1be773b3

    Install it and call the command like this:

    
    wp rhau acf-sync-field-groups
    

    (rhau is just my namespace for all my custom wp cli commands).

  • The development team does not routinely visit this forum, you need to send feature requests to them here https://www.advancedcustomfields.com/contact/

  • Thanks @hube2 , I have also written to the ACF team directly. Just thought that until the feature lands in ACF, my little plugin could come in handy for other users as well.

    I have already received a reply from the ACF devs. They will consider introducing a similar functionality in ACF core! 🎉

  • This reply has been marked as private.
  • Hi @nmaine , what’s the reason you did mark your post as private? Just curious 🙂

    Anyways – there were a few internal changes in ACF some versions ago, the gist was outdated. I have updated the code so that it should work with the latest version of ACF again.

  • HI, @rasso I marked the post as private so you could check I wasn’t doing something wrong. I have updated to your latest gist and the error went away. I need to test with some fields that need a sync, currently $field_groups_class->sync is empty. I’m excited you made this code, it’s going to save time when I deploy across multiple environments.

  • @rasso I just want to thank you for contributing your crucial plugin. I have it in my bitbucket-pipelines deployment script, where I’m updating many sites. I’ve been looking for this for years. This should be a built-in ACF feature, I’ll tag @iainpoulson just for grins 🙂

  • @rasso This…is…amazing! Can’t thank you enough 🤗

    This just solved a long-standing issue I’ve had with a very large field group with an even larger set of associated pages. The site in question is hosted on WP Engine and their PHP Timeout of 60 sec (aka the ‘Long Process Killer’) always kills my process, then I have to get on live chat, ask them to pause the LPK (it’s so bad I actually have a request snippet I just expand in to the chat 🤣), then my sync normally takes about 90 sec.

    Of course, there’s no PHP timeout through wp-cli. Enter your marvellous plugin. Just installed and ran it without a hitch!

    Indeed this should be core ACF functionality. I’m going to let my tech at WP Engine know I found the solution to this issue I was having a winge about last we talked.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.