actions - Are the hooks in the dashboard such as "load-$page_slug$" and "admin-head-$page_slug$&q

admin2025-06-03  8

I've created a page using add_theme_page with the name of access_page. Whenever someone accesses that page, or rather, for that page, a few hooks are created, such as admin-head-access_page and load-access_page.

Are these hooks guaranteed to be consistent everywhere, on every install?

I've created a page using add_theme_page with the name of access_page. Whenever someone accesses that page, or rather, for that page, a few hooks are created, such as admin-head-access_page and load-access_page.

Are these hooks guaranteed to be consistent everywhere, on every install?

Share Improve this question asked Feb 9, 2019 at 23:15 coolpastacoolpasta 9691 gold badge9 silver badges24 bronze badges 2
  • Why wouldn’t they be? – Jacob Peattie Commented Feb 10, 2019 at 3:48
  • @JacobPeattie I understand this could be a stupid question, but I was working with the rest_url and that changes depending on your "reading" settings, something I could never have known, just asking if they're consistent given all of WP's default settings. – coolpasta Commented Feb 10, 2019 at 17:10
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not exactly sure, if I get your question correctly, but...

Yes, these hooks are native WP hooks:

  • admin head-(page hook)
  • load-(page)

So if you create such page on given WP instance (for example you create it with your plugin/theme and that plugin/theme is active on that instance), then these hooks will get fired.

Of course if such page is not added on given WP instance, then that action won't get fired... (But how could it - if there is no such page, then it can't be displayed, then no actions will be run while it's requested).

I hope it answered your question.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748899191a314650.html

最新回复(0)