4

Using the WP_Screen object, is it possible to add additional tabs to a custom admin settings page?

I already have Screen Options and Help, but I also wish to add a Import/Export tab. I've looked in to extending the WP_Screen object, but it's declared as final in the core (/wp-admin/includes/screen.php, line 194 {ver 4.2.1}).

I'd consider adding my import/export option to the Screen Options tab, but looking at WP_Screen object I can't see that even this is possible. Edit This is possible using the screen_settings filter, but I'd still like to achieve my primary goal if possible.

  • I know, we had exactly this question already. – fuxia May 4 '15 at 10:52
  • 1
    And do you know where I can find that question, and if it has an accepted answer? The closest I have found is a hack using JS from 2010, which I believe is pre-WP_Screen (in it's current format anyway). – David Gard May 4 '15 at 14:13
  • Have you tried using add_help_tab()? codex.wordpress.org/Class_Reference/WP_Screen/add_help_tab – gdaniel May 28 '15 at 22:35
  • This is not possible with WordPress WP_Screen class right now, the tabs displayed are hard coded in render_screen_options() function of the same class. But you can use custom JS for this functionality. – WisdmLabs Aug 11 '15 at 7:51
-2

I changed my mind about "Most important: in the hook for validating updates, set-screen-option, pass the $value back if your plugin does not recognize the $option ! It's probably for another plugin!"

It's better to go with what the hook suggest and send back $status (which is false) if you don't know the $option.

To prevent conflicts with other plugins, instead I put in a $_GET['page'] check before adding the validator filter.

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.