[wp-hackers] How to determine which admin screen I'm currently viewing

Frank Bueltge frank at bueltge.de
Tue Nov 29 20:10:11 UTC 2011

I dont see a strategy about all admin pages; i use the global vars
$current_screen and $pagenow and $post_type.

if the $current_screen is not empty, then is this the best way, you
find all relevant values, especialy the id of hte current page.

best regards

On Tue, Nov 29, 2011 at 9:00 PM, 24/7 <24-7 at gmx.net> wrote:
> After inspecting core for about a day, I now had to come here to ask this
> Q, because I'm completely at the end with my ideas.
> I'm trying to write a plugin that needs to trigger on every admin UI page.
> Therefore I need to find out, where I exactly am.
> $GLOBALS['current_screen']; gives me some basic data, but when building the
> array I compare against, I have no clue where to get consistent data from.
> I use the globals $menu, $submenu; to build a multidimensional array
> containing the admin menu items as shown in this paste [1].
> Point is that already tried to compare against global $self,
> $current_screen, $parent_file, $submenu_file, $plugin_page,
> $admin_page_hooks, $_registered_pages, $_parent_pages; but none
> was consistent across all admin pages. I also couldn't get behind the logic
> what exactly is used where.
> I hope someone can give me a bit of an insight into this.
> Thanks a lot!
> Best wishes,
> Kaiser.
> [1] Pastebin w exemplary admin menu items http://pastebin.com/hssR1E16
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list