0

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?

  • Depends on the page you want to address. Show the code for that. – fuxia Dec 2 '12 at 22:56
  • that would be the main dashboard screen. – mikkelbreum Dec 7 '12 at 12:31
6
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, privacy policy and cookie policy

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