admin管理员组文章数量:1316540
I am working on a plugin that registers custom new endpoints in every update and we need to Flush Rewrite Rules after every update of the plugin.
Flushing Rewrite Rules are easy after activation of the plugin and there is a lot of tutorials out there about this
But in the case of Flushing Rewrite Rules after Update I can't find any solution
I am working on a plugin that registers custom new endpoints in every update and we need to Flush Rewrite Rules after every update of the plugin.
Flushing Rewrite Rules are easy after activation of the plugin and there is a lot of tutorials out there about this
But in the case of Flushing Rewrite Rules after Update I can't find any solution
Share Improve this question edited Dec 24, 2019 at 6:41 Kaperto 4783 silver badges10 bronze badges asked Dec 23, 2019 at 8:24 mir.moezimir.moezi 1013 bronze badges 2- 1 you can save the plugin version in an option and when the version change, you flush the cache. – Kaperto Commented Dec 23, 2019 at 9:23
- thank you your comment was the answer – mir.moezi Commented Dec 30, 2019 at 5:06
2 Answers
Reset to default 2Your answer above was close but is should be
add_action( 'upgrader_process_complete', 'wp_answ_355114' );
not
do_action( 'upgrader_process_complete', 'wp_answ_355114' );
noting that this is only the case when a plugin is updated view WP plugin updates.
I haven't verified this but you could try the upgrader_process_complete hook. More information on that hook.
like follows
function wp_answ_355114() {
flush_rewrite_rules();
}
do_action( 'upgrader_process_complete', 'wp_answ_355114' );
本文标签: hooksflush rewrite rules after plugin update
版权声明:本文标题:hooks - flush rewrite rules after plugin update? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742006016a2411968.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论