From 99d0d85fb0dcb31278a28bba451719004f531446 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Mon, 8 Jun 2015 12:34:03 +0000 Subject: [PATCH] Sort screen options for meta boxes according to the meta box's priority. Props swissspidy. Fixes #32582. git-svn-id: https://develop.svn.wordpress.org/trunk@32707 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/screen.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/screen.php b/src/wp-admin/includes/screen.php index 582c659ed1..2f7a6deae8 100644 --- a/src/wp-admin/includes/screen.php +++ b/src/wp-admin/includes/screen.php @@ -77,9 +77,12 @@ function meta_box_prefs( $screen ) { $hidden = get_hidden_meta_boxes($screen); - foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { - foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { - foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { + foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { + if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { + continue; + } + foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { if ( false == $box || ! $box['title'] ) continue; // Submit box cannot be hidden