Skip to content

Instantly share code, notes, and snippets.

@grok
Last active August 29, 2015 13:59
Show Gist options
  • Save grok/10745973 to your computer and use it in GitHub Desktop.
Save grok/10745973 to your computer and use it in GitHub Desktop.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in /wp-includes/plugin.php on line 429
<?php
final class Theme {
//...
private function _declare_dependencies()
{
if(!class_exists('GFForms'))
{
add_action('admin_notices', array_map(array($this, 'dependency_missing'), array('Gravity Forms')));
}
}
//..
}
?>
@grok
Copy link
Author

grok commented Apr 15, 2014

Fundamentally my code wasn't even working.

It only looked like it did because the array_map was calling the function -- duh.

The return was an array -- which is not a callable function -- which produced the error.

So I needed to break it out into simpler actions -- utilizing do_action and remove_action later so it isn't called twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment