After activating my plugin i should go to settings -> permalinks and click on 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. )

New contributor
amiwebdev is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Where/when did you call 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? – Tom J Nowell Sep 14 at 14:39

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.

| improve this answer | |

Your Answer

amiwebdev is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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