Last active
October 29, 2018 21:44
-
-
Save feliciaceballos/2af3016bcff422cf98f47629deb667d4 to your computer and use it in GitHub Desktop.
Create the WPMU DEV Forminator Recent Submissions Dashboard Widget, Update Widget Settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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