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?

  • Depends on the page you want to address. Show the code for that.
    – fuxia
    Dec 2, 2012 at 22:56
  • that would be the main dashboard screen. Dec 7, 2012 at 12:31

1 Answer 1

add_action( 'load-index.php', 'the_function', 1, 0 );

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.