I have a basic plugin in the admin options panel for events.

I want to call a function that is from a different social media plugin (Mingle). I can call the plugin functions in the theme, but not within core files of other plugins, or other plugins' admin panels it seems.

I have tried including the other plugin's files, adding a hook to the theme functions file, add_action, add_filter, init etc. But I do not know what the first argument for those actions would be, since I want the function inserted into a specific admin page from another plugin.

The only solution that has worked is merging the code of the two plugins, although it seems odd that there is not a simpler method.

  • Also both plugins declare their functions in a class
    – Graham
    Commented Jun 30, 2012 at 18:14

2 Answers 2


Maybe you should try calling the functions of your plugin using the plugins_loaded action.

Plugin A

class PluginA {
  public function func_a() {
    // do stuff

Plugin B

class PluginB {
  function functB() {
    if (class_exists('PluginA')) {
      //do stuff that depends of PluginA

add_action('plugins_loaded', 'call_plugin_a_using_plugin_b');
function call_plugin_a_using_plugin_b() {

According to the Codex, the plugins_loaded action fires after all plugins are loaded, so making sure that all plugins are loaded before calling a function from other plugin might be the way to go.


To call one function from one plugin in another plugin (inception?), you can try the following login:

You can try by checking for the function you want before doing anything else.

Plugin A:

function from_plugin_alpha( some_thing ) {
    // do stuff

Plugin B:

function from_plugin_bravo() {
    if ( !function_exists( 'from_plugin_alpha' ) ) {
    from_plugin_alpha( some_thing );

This checks that function exists before executing your custom code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.