#27888 (Feature request: `get_current_admin_url()` and `get_current_admin_hook()`) – WordPress Trac
#27888 assigned feature request
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Administration | Keywords: | good-first-bug has-patch needs-testing has-unit-tests |
Focuses: | administration | Cc: |
It would be sweet if to be able to get the current page's url using some kind of API. And its hook, for that matter. For instance:
public function get_current_admin_page_url() { if (!is_admin()) { return false; } global $pagenow; global $typenow; global $taxnow; global $plugin_page; $url = $pagenow; if (!empty($plugin_page)) { $url .= '?page='.$plugin_page; } elseif (!empty($typenow)) { $url .= '?post_type='.$typenow; } elseif (!empty($taxnow)) { $url .= '?taxonomy='.$taxnow; } return $url; }
And something similar for get_current_admin_hook()
.