Storing custom dashboard widget options in wordpress

Solution pulled from OP.

Ok fixed. In widget-config.php there is no check if the form has been submitted, so every time you load configuration it updates with empty values or keeps default ones. Add this check if (!empty($_POST)) before updating options values and display stored value of number-input:

<input type="text" name="number" value="<?php echo self::get_dashboard_widget_option(self::wid, 'example_number'); ?>" />

Leave a Comment