admin管理员组文章数量:1295303
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]
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]
Share
Improve this question
edited Apr 15, 2021 at 9:50
Rup
4,4004 gold badges29 silver badges29 bronze badges
asked Apr 15, 2021 at 9:00
ho quoc dungho quoc dung
1
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 Commented Apr 15, 2021 at 9:51
1 Answer
Reset to default 1Shortcodes 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.
本文标签: How to reload the shortcode content when the database is changing
版权声明:本文标题:How to reload the shortcode content when the database is changing 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741616319a2388544.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论