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

In the Wordpress admin, how can I programmatically find out which page (themes.php, widgets.php, etc.) I'm on?

share|improve this question
up vote 2 down vote accepted

You can determine that with wordpress' get_current_screen() function. It will not return just a page name though, it will give you an object containing a bunch of different data on what screen you're on.

share|improve this answer
For a properly formatted output of that function, use this code chunk - <pre><?php print_r(get_current_screen()); ?></pre> - it makes for a nice nested list, I use it whenever I need to echo any object or array-based variable. – SickHippie Mar 6 '12 at 18:02
Weird... get_current_screen() is reported as undefined. Do I have to declare a global variable into scope, or anything else? – julien_c Mar 6 '12 at 18:03
How are you calling it up? – SickHippie Mar 6 '12 at 18:03
I would probably use admin_head myself, but look here - wordpress.org/support/topic/… - to see an example that's working. Maybe you can take it from there? – SickHippie Mar 6 '12 at 18:16
You can also use admin_menu, but _admin_menu is too early and adminmenu too late. :) – kaiser Mar 6 '12 at 18:20

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.