- Removed uniqid feature (no longer needed).
- Bugfix: database fieldgroups are now prefered over exported fieldgroups.
- Cleaned up legacy xml import/export libraries.
- Add namespaces.
- Cleaned up all alternative notation uses.
- Multisite now correctly makes use of the global --url parameter.
- Added more comments and versioning.
- Removed dependency of wp-importer.
- Added support for composer installs.
- Dropped XML support, hello Json.
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 and love the WP-CLI command line tools.
- Advanced custom fields did not interface with WP-CLI
- Sharing
field-groupsthrough XML or PHP code caused problems with differences between development, test, staging and production enviroments when shared with XML. - No direct SVN or GIT support without manually putting the exported PHP or XML into a versioned directory.
- Naming convention for XML files was always the same, resulting in renaming hassle.
- Only using the generated
field-groupson runtime through PHP code infunctions.phpdisables the editing mode (which is an awesome UI that we require). So importing should be possible.
- Advanced Custom Fields plugin
wp-clihttp://wp-cli.org/
This project adds the acf command to wp-cli with the following subcommands:
-
wp acf: Default test and prints the help overview. -
wp acf status: provides a list of foundfield-groupsin the current database of your Wordpress project. -
wp acf export:- creates a
field-groupdirectory into your current theme's directory. - creates a directory with the
field-groupname for each fieldgroup. - creates a
data.phpanddata.jsonfor eachfield-groupinside their respective folders. - use
wp acf export allto export everything without prompting
- creates a
-
wp acf import: imports the XML(s) fromactive-theme/field-groups/{field-group_name}/data.xml`- When using wp acf import a selection menu apears to choose which field-group to import
-
wp acf clean: cleans up the database from all found ACF post types and their coupledpost_metavalues, use this after you've edited thefield-groupsin the UI and used export to generate the newdata.phpfiles. Watch out: cannot be undone.
- install
wp-clihttp://wp-cli.org/ - clone this repo as
advanced-custom-fields-wpcliin your plugins directory - activate
advanced-custom-fields-wpcliplugin through "wp plugin activate advanced-custom-fields-wpcli" (or activate in the plugin menu) - open a terminal and go to your wordpress directory
- type
wp(and see theacfcommands if installed correctly) - type
wp acfto test theacf-wpcliextension - start using the commands as explained in "Commands"
When the plugin is enabled, any exported field groups found on the filesystem in your registered paths will be added to Wordpress at runtime.
If you would like to disable this behaviour you can remove the acf_wpcli_register_groups action:
remove_action('plugins_loaded', 'acf_wpcli_register_groups');- acfwpcli_fieldgroup_paths By default ACF-CLI will search 2 paths for field-groups. The active_theme and active_child_theme. The acfwpcli_fieldgroup_paths gives you the ability to add more paths where ACF-CLI should load/export from/to. Example:
add_filter( 'acfwpcli_fieldgroup_paths', 'add_plugin_path' );
public function add_plugin_path( $paths ) {
$paths['my_plugin'] = MY_PLUGIN_ROOT . '/lib/field-groups/';
return $paths;
}- make
acf-wpcliextension update-proof - release this plugin as official WordPress plugin