Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliciaceballos/2af3016bcff422cf98f47629deb667d4 to your computer and use it in GitHub Desktop.
Save feliciaceballos/2af3016bcff422cf98f47629deb667d4 to your computer and use it in GitHub Desktop.
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Update Widget Settings
<?php
/**
* Update widget options
*
* @param array $options
*
* @return bool
*/
public function update_options( $options = array() ) {
//Fetch all dashboard widget options from the db...
$opts = get_option( 'dashboard_widget_options' );
//Get just our widget's options, or set empty array
$forminator_options = ( isset( $opts[ __CLASS__ ] ) ) ? $opts[ __CLASS__ ] : array();
// merge old one with new one
$opts[ __CLASS__ ] = array_merge( $forminator_options, $options );
// update option
return update_option( 'dashboard_widget_options', $opts );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment