Make WordPress Core

Ticket #42791: 42791.diff

File 42791.diff, 2.4 KB (added by davidjlaietta, 7 years ago)
  • src/wp-admin/includes/dashboard.php

    diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
    index 0da446d491..35748bc3d9 100644
    function wp_dashboard_setup() { 
    146146 * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null.
    147147 * @param array    $callback_args    Optional. Data that should be set as the $args property of the widget array
    148148 *                                   (which is the second parameter passed to your callback). Default null.
     149 * @param string   $context              Optional. The context within the screen where the boxes
     150 *                                   should display. Available contexts vary from screen to
     151 *                                   screen. Post edit screen contexts include 'normal', 'side',
     152 *                                   and 'advanced'. Comments screen contexts include 'normal'
     153 *                                   and 'side'. Menus meta boxes (accordion sections) all use
     154 *                                   the 'side' context. Default 'default'.
     155 * @param string   $priority         Optional. The priority within the context where the boxes
     156 *                                   should show ('high', 'low'). Default 'default'.
    149157 */
    150 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
     158function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $location = 'default', $priority = 'default' ) {
    151159        $screen = get_current_screen();
    152160        global $wp_dashboard_control_callbacks;
    153161
    function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ 
    173181
    174182        $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
    175183
    176         $location = 'normal';
    177         if ( in_array( $widget_id, $side_widgets ) ) {
    178                 $location = 'side';
     184        if ( $location === 'default' ) {
     185                $location = 'normal';
     186                if ( in_array( $widget_id, $side_widgets ) ) {
     187                        $location = 'side';
     188                }
    179189        }
    180190
    181         $priority = 'core';
    182         if ( 'dashboard_browser_nag' === $widget_id ) {
    183                 $priority = 'high';
     191        if ( $priority === 'default' ) {
     192                $priority = 'core';
     193                if ( 'dashboard_browser_nag' === $widget_id ) {
     194                        $priority = 'high';
     195                }
    184196        }
    185197
    186198        add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );