Support » Plugins » Hacks » Plugin functions to use on other plugins

  • ShMk


    I have to wrote a plugin with a function that has to be recalled by another plugin (or maybe more than one).

    I have to insert this function in a particolar point of the plugin to make it visible to all plugins?
    How can I load my plugin before other plugins?

Viewing 3 replies - 1 through 3 (of 3 total)
  • admcfajn


    <?php require_once(‘path to file with function you need dot whatever’); ?>

    this should work:

    add_action('init', 'getMyFunction');

    contents of something-epic.php:


    More here:



    Thank you!

    If my_function is used by other plugins but only in the backend I have to use ‘admin_init’ instead, or ‘init’ is fine?

    Moderator bcworkz


    I hope you both don’t mind my jumping in.

    ‘init’ will work, but it’s not really ‘fine’. Using ‘init’ will cause your code to be needlessly loaded many many times. If everyone did this, it would drag down the whole system. ‘admin_init’ is much better for backend code, it is more likely to be loaded only when needed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin functions to use on other plugins’ is closed to new replies.