$wpdb->update is not working until next page refresh. Is there one more step?

When you use $wpdb->update in WordPress, it updates the database immediately, but WordPress might still show cached data. To ensure the updated data is displayed right away, you should manually clear the post cache using clean_post_cache($pid); after the update. Here’s the adjusted code:

$pid  = 55276;
$post = get_post($pid);

echo 'original post:<BR>'.$post->post_excerpt.'<HR>';

$newtext="some textt2";
global $wpdb;
$worked = $wpdb->update($wpdb->posts, ['post_excerpt' => $newtext], ['ID' => $pid]);
echo 'update worked?: '.$worked.'<HR>';

// Clear the post cache
clean_post_cache($pid);

// Fetch the post again
$post = get_post($pid);
echo 'new post:<BR>'.$post->post_excerpt.'<BR>';

tech