In Codex I found that the best action to call add_rewrite_rule is the init action. So in this way the function is called every time the site load. But to save the rule in rewrite_rules option it would be better to call it in register_activation_hook?

1 Answer
1

Rules should be added on init because other code might flush rewrite rules, which would cause your rules to disappear.

Leave a Reply

Your email address will not be published. Required fields are marked *