After activating my plugin I should go to settings -> permalinks
and click on the Save button to make custom endpoints ( for my-account page ) work. How can I do it programmatically? ( I used flush_rewrite_rules
but it didn't work. )
1 Answer
flush_rewrite_rules
should only be called on the plugin activation OR after you update or add rewrite rules programatically.
If it does not work after verifying this, there is some other issue on your site. Make sure you are not calling flush_rewrite_rules
in constructor or somewhere else on every page load.
flush_rewrite_rules
? Keep in mind that this function shouldn't be called on every page load as it changes the database, can you include the code you used to try this?