The reviewer of my theme told me that flush_widget_cache()
which I have used in one of my widgets is deprecated since version 4.4. I have searched for this method on codex but there is only a description that this function is deprecated and that's it.
Can anybody tell me that which method should i use instead of flush_widget_cache()
?
Here is a code spinet from my widget (recent posts):
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['number'] = (int) $new_instance['number'];
$instance['show_date'] = (bool) $new_instance['show_date'];
$this->flush_widget_cache();
$alloptions = wp_cache_get( 'alloptions', 'options' );
if ( isset($alloptions['widget_recent_entries']) )
delete_option('widget_recent_entries');
return $instance;
}
function flush_widget_cache() {
wp_cache_delete('widget_recent_posts', 'widget');
}
Thanks.