Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carlaizumibamford/598a6e5a0e6966895184d1456822ca71 to your computer and use it in GitHub Desktop.
Save carlaizumibamford/598a6e5a0e6966895184d1456822ca71 to your computer and use it in GitHub Desktop.
Creating A Custom Wordpress Widget Plugin Vol 5
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
$instance['text'] = isset( $new_instance['text'] ) ? wp_strip_all_tags( $new_instance['text'] ) : '';
$instance['textarea'] = isset( $new_instance['textarea'] ) ? wp_kses_post( $new_instance['textarea'] ) : '';
$instance['checkbox'] = isset( $new_instance['checkbox'] ) ? 1 : false;
$instance['select'] = isset( $new_instance['select'] ) ? wp_strip_all_tags( $new_instance['select'] ) : '';
return $instance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment