WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out the best approach to add additional functionality that will only be utilized by admins via /wp-admin.

What's the best way to implement so that resources aren't being wasted. I.E. if statement each page load or any other code execution on each page load for areas not even pertaining to the dashboard.


share|improve this question
up vote 1 down vote accepted

There is number of dynamic hooks in admin-header.php that allows to precisely target on which pages to load your code.

And naturally current_user_can() check so it only runs for admins.

share|improve this answer

Your Answer


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.