Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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 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 at 16:58
    
I guess you have to store the information somewhere, db, xml file, or whatever. –  johnny Apr 28 at 16:59
    
Is registering a hook or plugin the same as adding a callback? –  johnny Apr 28 at 17:22
    
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 at 1:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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