Hi
could you please confirm that the user changes its name information from admin OR front end of the site using the widget?
While update post/page or any widget area from admin. Breeze clears its cache and change will reflect on site.
Yes the user edits his name from the front end.
function my_woocommerce_save_account_details($user_id) {
$fn = $_POST[‘account_first_name’];
$ln = $_POST[‘account_last_name’];
$display_name = trim(trim($fn) . ‘ ‘ . trim($ln));
$x = wp_update_user( array( ‘ID’ => $user_id, ‘display_name’ => sanitize_text_field(remove_accents($display_name)) ) );
}
add_action( ‘woocommerce_save_account_details’, ‘my_woocommerce_save_account_details’, 10, 1 );
Then when the user visits a page (that has already been cached) it will not show the new display name in a widget in the sidebar of every page.
I guess I need to put in a command into my code like
breeze_clean_cache();
Or alternatively I could do an “insert_post” and then “delete_post” to cause the cache to be cleared.
Let me know what you would recommend.
Thanks!
P.S. I tried adding this into my name-update code (shown above). It did not force the cache to be cleared.
// Create post object
$my_post = array();
$my_post[‘post_title’] = ‘Temp post’;
$my_post[‘post_content’] = ‘This is a temp post made to force the cache to clear.’;
$my_post[‘post_status’] = ‘publish’;
$my_post[‘post_author’] = 1;
$my_post[‘post_category’] = array(0);
$id = wp_insert_post( $my_post );
wp_delete_post($id);
Surely there must be a simple command you can give me that will do this?