WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#40379 closed defect (bug) (invalid)

newticket#ticket

Reported by: adminhoang Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: General Keywords:
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

 //Fetch ALL dashboard widget options from the db...
    $opts = get_option( 'dashboard_widget_options' );

    //Get just our widget's options, or set empty array
    $w_opts = ( isset( $opts[$widget_id] ) ) ? $opts[$widget_id] : array();

    if ( $add_only ) {
        //Flesh out any missing options (existing ones overwrite new ones)
        $opts[$widget_id] = array_merge($args,$w_opts);
    }
    else {
        //Merge new options with existing ones, and add it back to the widgets array
        $opts[$widget_id] = array_merge($w_opts,$args);
    }

    //Save the entire widgets array back to the db
    return update_option('dashboard_widget_options', $opts);
}

Change History (2)

#1 @SergeyBiryukov
3 years ago

  • Description modified (diff)
  • Focuses javascript docs template removed

Hi @adminhoang, welcome to WordPress Trac!

This Trac is used for enhancements and bug reporting for the WordPress core software.

Could you clarify what you are trying to do?

#2 @johnbillion
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.