0

I use Wordpress plugin: snippets to show some data in database. Everything is OK, however, when I change the content in the database. After that I refresh many time in the page. And the content is not change. I close the web page, and wait for 5 minutes. Reopen the page again, the content is updated. What happens in my situation? Please give me some suggestion!

In Snippets:

public function some_function() {
    global $wpdb;
    $results = $wpdb->get_var( 
        $wpdb->prepare("SELECT count(ID) as total FROM {$wpdb->prefix}sample_table") 
        );
    return $results;
}
add_shortcode('sample_shortcode', 'some_function');

In the Page - I add the shortcode

[sample_shortcode]
1
  • 1
    This is probably caching then, either in the code snippet plugin (if it does that) or on your web server or on your CDN if you have one or on your browser (because of server caching configuration)
    – Rup
    Apr 15, 2021 at 9:51

1 Answer 1

1

Shortcodes don't need to be refreshed, they aren't cached.

Instead it sounds like you have either CDN, page, browser, or database caching. Check for caching plugins that need clearing, and flush any CDN caches you might have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.