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.
Maybe you should try calling the functions of your plugin using the
plugins_loaded
action.Plugin A
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:
Plugin B:
This checks that function exists before executing your custom code.