Make WordPress Core

Ticket #16828: 16828.diff

File 16828.diff, 2.5 KB (added by barryceelen, 7 years ago)

Boldly deprecate wp_initial_nav_menu_meta_boxes()

  • wp-admin/includes/deprecated.php

    diff --git wp-admin/includes/deprecated.php wp-admin/includes/deprecated.php
    index ab5ddafd17..3413c11af2 100644
    function post_form_autocomplete_off() { 
    14911491                echo ' autocomplete="off"';
    14921492        }
    14931493}
     1494
     1495/**
     1496 * This was once used to limit the amount of meta boxes to pages, posts, links, and categories for first time users.
     1497 *
     1498 * @since 3.0.0
     1499 * @deprecated 4.9.0
     1500 * @access private
     1501 *
     1502 * @global array $wp_meta_boxes
     1503 **/
     1504function wp_initial_nav_menu_meta_boxes() {
     1505        _deprecated_function( __FUNCTION__, '4.9.0' );
     1506}
  • wp-admin/includes/nav-menu.php

    diff --git wp-admin/includes/nav-menu.php wp-admin/includes/nav-menu.php
    index a6aac33053..01dac127c9 100644
    function wp_nav_menu_setup() { 
    153153        }
    154154}
    155155
    156 /**
    157  * Limit the amount of meta boxes to pages, posts, links, and categories for first time users.
    158  *
    159  * @since 3.0.0
    160  *
    161  * @global array $wp_meta_boxes
    162  **/
    163 function wp_initial_nav_menu_meta_boxes() {
    164         global $wp_meta_boxes;
    165 
    166         if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
    167                 return;
    168 
    169         $initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' );
    170         $hidden_meta_boxes = array();
    171 
    172         foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
    173                 foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
    174                         foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
    175                                 if ( in_array( $box['id'], $initial_meta_boxes ) ) {
    176                                         unset( $box['id'] );
    177                                 } else {
    178                                         $hidden_meta_boxes[] = $box['id'];
    179                                 }
    180                         }
    181                 }
    182         }
    183 
    184         $user = wp_get_current_user();
    185         update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
    186 }
    187 
    188156/**
    189157 * Creates meta boxes for any post type menu item..
    190158 *
  • wp-admin/nav-menus.php

    diff --git wp-admin/nav-menus.php wp-admin/nav-menus.php
    index d8fc77f01d..a77b596e34 100644
    function wp_nav_menu_max_depth( $classes ) { 
    511511add_filter('admin_body_class', 'wp_nav_menu_max_depth');
    512512
    513513wp_nav_menu_setup();
    514 wp_initial_nav_menu_meta_boxes();
    515514
    516515if ( ! current_theme_supports( 'menus' ) && ! $num_locations )
    517516        $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>';