diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index a9064fca46..7d08b2ae4b 100644 --- a/src/wp-admin/includes/class-wp-screen.php +++ b/src/wp-admin/includes/class-wp-screen.php @@ -512,23 +512,26 @@ final class WP_Screen { */ public function get_help_tabs() { $help_tabs = $this->_help_tabs; - uasort( $help_tabs, array( $this, '_sort_help_tabs' ) ); - return $help_tabs; - } - /** - * Compares the difference between the help tabs priorities. - * - * Used for help tabs sorting. - * - * @since 4.4.0 - * - * @param int $tab_a The priority argument for the first tab. - * @param int $tab_b The priority argument for the second tab. - * @return int The difference between the priority arguments. - */ - protected function _sort_help_tabs( $tab_a, $tab_b ) { - return $tab_a['priority'] - $tab_b['priority']; + $priorities = array(); + foreach ( $help_tabs as $help_tab ) { + if ( isset( $priorities[ $help_tab['priority'] ] ) ) { + $priorities[ $help_tab['priority'] ][] = $help_tab; + } else { + $priorities[ $help_tab['priority'] ] = array( $help_tab ); + } + } + + sort( $priorities ); + + $sorted = array(); + foreach ( $priorities as $list ) { + foreach ( $list as $tab ) { + $sorted[ $tab['id'] ] = $tab; + } + } + + return $sorted; } /** diff --git a/tests/phpunit/tests/admin/includesScreen.php b/tests/phpunit/tests/admin/includesScreen.php index 898bb4608c..65603e315d 100644 --- a/tests/phpunit/tests/admin/includesScreen.php +++ b/tests/phpunit/tests/admin/includesScreen.php @@ -38,7 +38,7 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase { function tearDown() { unset( $GLOBALS['wp_taxonomies']['old-or-new'] ); - set_current_screen( 'front' ); + unset( $GLOBALS['screen'] ); parent::tearDown(); }