WP_Widget_Recent_Posts::update()
Handles updating the settings for the current Recent Posts widget instance.
Method of the class: WP_Widget_Recent_Posts{}
No Hooks.
Return
Array
. Updated settings to save.
Usage
$WP_Widget_Recent_Posts = new WP_Widget_Recent_Posts(); $WP_Widget_Recent_Posts->update( $new_instance, $old_instance );
- $new_instance(array) (required)
- New settings for this instance as input by the user via WP_Widget::form().
- $old_instance(array) (required)
- Old settings for this instance.
Changelog
Since 2.8.0 | Introduced. |
WP_Widget_Recent_Posts::update() WP Widget Recent Posts::update code WP 6.8
public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['number'] = (int) $new_instance['number']; $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; return $instance; }