2

When WordPress installs a plugin, where does it keep the fact of a hook/plugins existence? For example, wp-includes/plugin.php

I can see do_action, but I'm not familiar enough to know how WP loads its plugins. Does it have the hook name in the database along with the new plugged in hook name? I looked in wp_options, but did not anything.

1 Answer 1

4

WordPress stores the currently active plugins in the options table under the key active_plugins.

Hooked actions and filters aren't stored anywhere, plugins must add their hooks on every request, otherwise they don't exist.

5
  • I didn't put that I saw active_plugins, sorry. But what I didn't know is that all the plugins are called with each request. Doesn't that make things very slow?
    – johnny
    Apr 28, 2014 at 16:50
  • well sure, there is some overhead to including files, but slower than what alternative exactly? it ultimately depends on what the plugin does. there are other methods to get far greater performance gains than worrying about a few hundredths of a millisecond here and there.
    – Milo
    Apr 28, 2014 at 16:58
  • I guess you have to store the information somewhere, db, xml file, or whatever.
    – johnny
    Apr 28, 2014 at 16:59
  • 1
    Is registering a hook or plugin the same as adding a callback?
    – johnny
    Apr 28, 2014 at 17:22
  • 1
    you can invoke custom hooks that other code can hook a callback to, via do_action or apply_filters. when you add_action or add_filter, you're registering a callback for that action or filter hook.
    – Milo
    Apr 29, 2014 at 1:20

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.