• Resolved hugw

    (@hugw)


    Hey there,

    When i try to remove “dashboard_primary” via remove_meta_box( ‘dashboard_primary’, ‘dashboard’, ‘side’ ), nothing works.

    After some digging i found that it is been applied a low priority to it when its registered, in this case, it will never been removed according to this piece of code in template.php

    function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
    
    ...
    
    	if ( empty($priority) )
    		$priority = 'low';
    	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
    		$wp_meta_boxes[$page][$context][$priority] = array();
    
    	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
    }

    On dashboard.php

    function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
    	...
    	$priority = 'core';
    	if ( 'dashboard_browser_nag' === $widget_id )
    		$priority = 'high';
    	elseif ( 'dashboard_primary' === $widget_id )
    		$priority = 'low';
    	add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
    }

    It does not check if is set to FALSE then return NULL. The question is, it is intended? It will not be possible anymore to remove it? or is a bug?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Remove dashboard_primary from Dashboard’ is closed to new replies.