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.

I'm trying to add a screen option to the dashboard screen.

I have a function like:

my_function() {

    ...
    add_screen_option()
    ...

}

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
add comment

1 Answer

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
add comment

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.