Communicate between plugins

I have created two WordPress plugins. If both plugins are installed, some beneficial cooperation could take place between the two.

So my question: what is the best way to get them to work together? How do I detect a certain plugin is enabled? How do I transmit information? I suppose I could use globals, but is there a better way?

Related posts

Leave a Reply

1 comment

  1. your question depends a lot on what you want to do ..

    But in general , when a plugin is loaded or executed, the functions are being “registered” in PHP server and are available for all to use (depending of course HOW you write them) …

    So for example, to detect if a plugin is enabled or installed, the other plugin could have

    if (function_exists('NameOfFunctionFromPlugin1')

    there is also a wordpress function to check plugin activation

    <?php is_plugin_active($plugin) ?>
    

    http://codex.wordpress.org/Function_Reference/is_plugin_active

    as for “transmitting Info” : Because the functions are available, you could use them. so for example, a value that is returned from a certain function in one plugin, can be evoked by the other , calling this function , and getting the value returned for use .