AP_Questions_Widget::update( array $new_instance, array $old_instance )

Description #

Update widget form.

Parameters #

  • $new_instance
    array (Required) New data.
  • $old_instance
    array (Required) Old data.

Source #

File: widgets/questions.php

	public function update( $new_instance, $old_instance ) {
		$instance = array();

		$instance['title']        = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
		$instance['avatar']       = ( ! empty( $new_instance['avatar'] ) ) ? wp_strip_all_tags( $new_instance['avatar'] ) : '';
		$instance['order_by']     = ( ! empty( $new_instance['order_by'] ) ) ? wp_strip_all_tags( $new_instance['order_by'] ) : '';
		$instance['limit']        = ( ! empty( $new_instance['limit'] ) ) ? wp_strip_all_tags( $new_instance['limit'] ) : 5;
		$instance['category_ids'] = ( ! empty( $new_instance['category_ids'] ) ) ? wp_strip_all_tags( $new_instance['category_ids'] ) : '';

		return $instance;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment