How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin

Question

I have created a plugin that register a new CPT but it doesnt work because i have to flush_rewrite_rules()
(i can do this by going into the permalink setting page and save, but its not the right way)

I have read inside the wordpress codex that i have to flush_rewrite_rules() on activation, but its not working cuz flush_rewrite_rules() runs before i register the CPT, to work it must run after…

I am using this https://github.com/DevinVinson/WordPress-Plugin-Boilerplate

And it has a class that runs on activation of the plugin i have added there this flush_rewrite_rules()

0
NeaMitika 3 months 0 Answers 23 views 0

Leave an answer