This extension for Advanced Custom Fields that makes it possible to manage your field_groups through the console of wp-cli. The goal of this project is to make life easier for developers who working on Wordpress projects that use Advanced Custom Fields.
wp-clidid not interface with ACF.- Sharing
field_groupsthrough XML or PHP code caused problems with differences between development, test, staging and live enviroments when shared with XML. - No direct SVN or GIT support without manually putting the exported PHP or XML into a versioned folder.
- Naming convention for XML files was always the same, resulting in renaming hassle.
- Inconsitensy when selecting multiple
field_groupsby XML. - Generated
field_groupson runtime through PHP code infunctions.phpdiables the editing mode (which is an awesome UI that we require)
- Advanced Custom Fields plugin (activated)
wp-clidownload from GitHub or use the pear package
This project adds the acf command to wp-cli with the following subcommands:
-
wp acf status: provides a dumped array of foundfield_groupsin the current database of your Wordpress project. -
wp acf export:- writes a
field_groupfolder inhttpdocs(or other root folder of your Wordpress installation). - writes a folder with the
field_groupname for eachfound_fieldgroup. - writes a
data.phpanddata.xmlfor eachfield_groupinside their respective folders.
- writes a
-
wp acf import: imports the XML(s) from the pathfield_groups/{blog_id}/{field_group_name}/data.xmlwp acf import allimports all the found field-groups from their respective folderswp acf import field-group-nameimports only a single field group
-
wp acf clean: cleans up the database from all found ACF post types and there coupledpost_metavalues, use this after you've edited thefield_groupsin the UI and used export to generate the newdata.phpfiles. -
wp acf: Default test and prints the help overview.
- install
wp-cli(pear or download) - put the
advanced-custom-fields-wpclifolder inwp-content/plugins - activate
advanced-custom-fields-wpcliplugin through "wp plugin activate advanced-custom-fields-wpcli" - go the terminal and go to your wordpress folder
- type
wp(and see the wp-cli commands if installed correctly) - type
wp acfto test theacf-wpcliextension - start using the commands as explained in "Commands"
- make
acf-wpcliextension update-proof - try to make
acf-wpclia real part of ACF through the plugin creator Elliot Condon Advanced Custom Fields - clean up code and refractor
- add more comments and versioning
- relocate the
field_groupsfolder to something that makes a little more sense - try to fix the
wp-importerproblem that caused the use of copied code fromwp-importerplugin
- made multisite compatible for both console and cms part
- Moved the extension out of advanced-custom-fields to it's own plugin folder to resolve update issues bound to happen
- Check to make sure the plugin admin code will only be ran when the ACF plugin is already loaded
- Initial project start
- Added status, export, import and clean commands
- Used wordpress-importer classes directly in the project
- moved the data.php or use database check to advanced-custom-fields/wp-cli/run.php
- wrote first version of readme.txt