March 2020
Beginner
660 pages
18h 28m
English
In step 5 of this recipe, we implemented the update function. The update function has two parameters, called $new_instance and $old_instance. Once the options of a widget have been updated, this function will be called with modified values in $new_instance. $old_instance contains the values before the widget options were updated. First, we assign $old_instance to a new variable called $instance. Then, we retrieve the modified values from $new_instance and assign it to $instance with necessary filtering. Finally, we return the modified $instance variable and the data will be saved automatically to the database.
At this stage, the widget's functionality is completed and the widget has been ...
Read now
Unlock full access