afragen / wp-dependency-installer

A lightweight class to add to WordPress plugins/themes to automatically install plugin dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning: call_user_func_array() expects parameter 1 to be a valid callback

JiveDig opened this issue · comments

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'PAnD' not found in /Users/JiveDig/ValetSites/merlin/wp-includes/class-wp-hook.php on line 286

When I remove dependency installer I don't see this. Using the latest from https://raw.githubusercontent.com/afragen/wp-dependency-installer/master/wp-dependency-installer.php, which accordingly to the Releases is 1.4.10

Similar: afragen/git-updater#453

FWIW, I'm doing this via my theme's functions.php file:

require_once 'includes/dependencies/wp-dependency-installer.php';
WP_Dependency_Installer::instance()->run( dirname( __FILE__ ) . '/includes/dependencies' );

And if I run it later it goes away, but not sure of the consequences:

require_once 'includes/dependencies/wp-dependency-installer.php';
add_action( 'admin_init', function() {
	WP_Dependency_Installer::instance()->run( dirname( __FILE__ ) . '/includes/dependencies' );
});

Update: Using via Composer does work. Probably better if I do it that way anyway.

WP_Dependency_Installer::instance()->run( __DIR__ );```

Designed to run through composer.

K, if it's not meant to work any other way than with composer (my current themes are not using composer) then I'll close. Updating all my themes now with this.

It really does need composer as the dependencies might also require composer’s autoloader.

There’s probably a way to make it work without composer but if there are issues it will be difficult to trace.

All good. My old themes (currently live on quite a few sites) have the older non-composer setup and it has worked well. Only issue would be if they use another plugin that uses the newer version and possibly hit a conflict. Unlikely though.