Skip to content

Commit fdcbb50

Browse files
committed
Merge branch 'master' of github.com:mcguffin/acf-customizer
2 parents 69679fb + 32091d4 commit fdcbb50

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

include/ACFCustomizer/Core/Core.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ class Core extends Plugin implements CoreInterface {
2424

2525
public $preview_js = null;
2626

27+
private $is_loaded = false;
28+
2729
/**
2830
* @inheritdoc
2931
*/
3032
protected function __construct() {
31-
32-
add_action( 'init' , array( $this , 'init_compat' ), 0 ); // must run before hook acf/include_location_rules
33+
add_action( 'plugins_loaded' , array( $this , 'init_compat' ), 0 ); // must run before hook acf/include_location_rules (acf as regular plugin)
34+
add_action( 'init' , array( $this , 'init_compat' ), 0 ); // must run before hook acf/include_location_rules (acf bundled in theme)
3335
add_action( 'init' , array( $this , 'init_assets' ) );
3436

3537
$args = func_get_args();
@@ -42,7 +44,8 @@ protected function __construct() {
4244
* @action plugins_loaded
4345
*/
4446
public function init_compat() {
45-
if ( function_exists('acf') && version_compare( acf()->version, '5.6','>=' ) ) {
47+
if ( function_exists('acf') && version_compare( acf()->version, '5.6','>=' ) && $this->is_loaded === false) {
48+
$this->is_loaded = true; //Enshure single instance
4649
Compat\ACF\ACF::instance();
4750
}
4851
}

0 commit comments

Comments
 (0)