wp_dashboard_trigger_widget_control example

$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
    }

    foreach ( $dashboard_widgets as $widget_id ) {
        $name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __( 'View all' ) . '</a>';
        wp_add_dashboard_widget( $widget_id$name$wp_registered_widgets[ $widget_id ]['callback']$wp_registered_widget_controls[ $widget_id ]['callback'] );
    }

    if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
        check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
        ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.         wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
        ob_end_clean();
        wp_redirect( remove_query_arg( 'edit' ) );
        exit;
    }

    /** This action is documented in wp-admin/includes/meta-boxes.php */
    do_action( 'do_meta_boxes', $screen->id, 'normal', '' );

    /** This action is documented in wp-admin/includes/meta-boxes.php */
    do_action( 'do_meta_boxes', $screen->id, 'side', '' );
}

Home | Imprint | This part of the site doesn't use cookies.