get_admin_page_title

The WordPress Core get admin page title function.

Description

get_admin_page_title(); 

Usage

  1. if ( !function_exists( 'get_admin_page_title' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/plugin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_admin_page_title(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/plugin.php  
  1. function get_admin_page_title() { 
  2. global $title, $menu, $submenu, $pagenow, $plugin_page, $typenow; 
  3.  
  4. if ( ! empty ( $title ) ) 
  5. return $title; 
  6.  
  7. $hook = get_plugin_page_hook( $plugin_page, $pagenow ); 
  8.  
  9. $parent = $parent1 = get_admin_page_parent(); 
  10.  
  11. if ( empty ( $parent) ) { 
  12. foreach ( (array)$menu as $menu_array ) { 
  13. if ( isset( $menu_array[3] ) ) { 
  14. if ( $menu_array[2] == $pagenow ) { 
  15. $title = $menu_array[3]; 
  16. return $menu_array[3]; 
  17. } elseif ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) { 
  18. $title = $menu_array[3]; 
  19. return $menu_array[3]; 
  20. } else { 
  21. $title = $menu_array[0]; 
  22. return $title; 
  23. } else { 
  24. foreach ( array_keys( $submenu ) as $parent ) { 
  25. foreach ( $submenu[$parent] as $submenu_array ) { 
  26. if ( isset( $plugin_page ) && 
  27. ( $plugin_page == $submenu_array[2] ) && 
  28. ( $parent == $pagenow ) || 
  29. ( $parent == $plugin_page ) || 
  30. ( $plugin_page == $hook ) || 
  31. ( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) || 
  32. ( !empty($typenow) && $parent == $pagenow . '?post_type=' . $typenow) 
  33. ) { 
  34. $title = $submenu_array[3]; 
  35. return $submenu_array[3]; 
  36.  
  37. if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page 
  38. continue; 
  39.  
  40. if ( isset( $submenu_array[3] ) ) { 
  41. $title = $submenu_array[3]; 
  42. return $submenu_array[3]; 
  43. } else { 
  44. $title = $submenu_array[0]; 
  45. return $title; 
  46. if ( empty ( $title ) ) { 
  47. foreach ( $menu as $menu_array ) { 
  48. if ( isset( $plugin_page ) && 
  49. ( $plugin_page == $menu_array[2] ) && 
  50. ( $pagenow == 'admin.php' ) && 
  51. ( $parent1 == $menu_array[2] ) ) 
  52. $title = $menu_array[3]; 
  53. return $menu_array[3]; 
  54.  
  55. return $title;