Nitin Baldha
asked 5 years ago

Hi,
I guess currently this class “dw_focus_top_posts” uses couple of caches to get/save post lists, and it has following action in it’s “__construct” function.
add_action( ‘save_post’, array(&$this, ‘flush_widget_cache’) );
add_action( ‘deleted_post’, array(&$this, ‘flush_widget_cache’) );
add_action( ‘switch_theme’, array(&$this, ‘flush_widget_cache’) );
 
When I insert the posts using “wp_insert_post” function,  this slider does not get updated with inserted post. Will it help if I add following actions along with above three actions ?
add_action( ‘new_to_publish’, array(&$this, ‘flush_widget_cache’) );
add_action( ‘insert_post’, array(&$this, ‘flush_widget_cache’) );

please advice. I tried to put “wp_cache_delete(‘widget_recent_posts’, ‘widget’);” right after my “wp_insert_post” code but it seems not working.
 
 
 

Nitin Baldha
replied 5 years ago

Fixed.

1 Answers
DominicStaff
answered 5 years ago

Apologies for the delay in replying to you.
That’s great! Can you share me your solution? We could learn from it and make improvement
Regards,

Powered by DW Question & Answer Pro