[wp-hackers] hook init for specific admin page?
gaarai at gaarai.com
Wed Aug 5 23:16:27 UTC 2009
When a core admin page is loaded, then an action load-filename is fired.
For example, the action load-import.php is fired when the Tools > Import
page (wp-admin/import.php) is loaded.
Things change when you are talking about menu entries added by plugins
are run. To detail out all the actions available and how to work with
them, I built a plugin.
Unzip the file, upload it to wp-content/plugins, and activate the Plugin
Action Hook Test plugin.
On all admin pages, two lines of output will appear above the header
detailing the plugin's menu page ref. Additional output can be seen by
going to Tools > Tools, Tools > Import, or Tools > Action Hook Test.
I know that outputting visible text before and inside the header is
messy, but it makes seeing what is happening and when very easy.
Now that I think about it, I believe your question was much more simple
than I originally thought. If you simply want an action that runs on
plugins.php load, it would be load-plugins.php.
Stephen Rider wrote:
> Hi --
> A patch I made was just committed (thanks westi).
> It's park of the Manage Plugins screen, and I hook a function on
> admin_init. Question: isn't there an init hook for each specific
> admin page? Something like admin_init_$page ? Seems that might be a
> touch more efficient.
> I see admin_head-$page_hook, but don't know what the page hook is for
> the plugins page. Is it just "plugins.php"?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers