WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 add a screen option to the dashboard screen.

I have a function like:

my_function() {



Now, I need to know the correct action hook $hook to use hooking in my function when the dashboard screen is loaded:

add_action( "load-$hook", 'my_function' );

What should $hook be?

share|improve this question
Depends on the page you want to address. Show the code for that. – toscho Dec 2 '12 at 22:56
that would be the main dashboard screen. – mikkelbreum Dec 7 '12 at 12:31
up vote 5 down vote accepted
add_action( 'load-index.php', 'the_function', 1, 0 );

The load-{page_hook} hook works with the filename of the page to load.

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.