From ba3a5a41dff48f2269ecde5a5bbb9669c02a8996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Mart=C3=ADnez?= Date: Tue, 23 Aug 2016 10:51:04 +0200 Subject: [PATCH] Add trailingslashit() to $export_path When leaving out the trailing slash the export becomes `directorynamefilename.json` instead of `directory/filename.json` and all files get exported to the same level. Filter: ``` function wt_acfwpcli_fieldgroup_paths(){ return [ get_template_directory_uri() . '/field-groups']; } add_filter('acfwpcli_fieldgroup_paths', 'wt_acfwpcli_fieldgroup_paths'); ``` --- lib/acfwpcli/cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/acfwpcli/cli.php b/lib/acfwpcli/cli.php index d9e227e..cf00c06 100644 --- a/lib/acfwpcli/cli.php +++ b/lib/acfwpcli/cli.php @@ -87,7 +87,7 @@ function export( $args, $assoc_args ) { foreach ( $field_groups as $post ) { $field_group = \ACFWPCLI\FieldGroup::to_array( $post ); - $file = $export_path . sanitize_title( $post->post_title ) . '.json'; + $file = trailingslashit( $export_path ) . sanitize_title( $post->post_title ) . '.json'; \ACFWPCLI\FieldGroup::to_json_file( $field_group, $file ); WP_CLI::success( "Exported field group: {$post->post_title}" );