From 5fd0ca47c1a8c9fe71a6a88c5b404d64bfb085da Mon Sep 17 00:00:00 2001 From: Marcel Dillen Date: Wed, 2 Aug 2017 13:31:38 +0200 Subject: [PATCH] Add paths and change hook to after_setup_theme --- lib/acfwpcli.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/acfwpcli.php b/lib/acfwpcli.php index 33a05dc..56afa78 100644 --- a/lib/acfwpcli.php +++ b/lib/acfwpcli.php @@ -11,7 +11,7 @@ public function __construct() { public function actions() { if ( ! defined( 'WP_CLI' ) ) { - add_action( 'plugins_loaded', array( $this, 'add_runtime_fieldgroups' ) ); + add_action( 'after_setup_theme', array( $this, 'add_runtime_fieldgroups' ) ); } } @@ -26,7 +26,10 @@ public function add_runtime_fieldgroups() { $db_field_group_titles[] = $db_group->post_title; } - $paths = []; + $paths = [ + 'active_theme' => get_template_directory() . '/field-groups/', + 'active_child_theme' => get_stylesheet_directory() . '/field-groups/', + ]; $paths = apply_filters( 'acfwpcli_fieldgroup_paths', $paths ); $patterns = [];