Hot answers tagged rewrite-rules
Rewrite rules are stored in an option. When flush_rewrite_rules() is called, this option is removed, WordPress collects all rules registered during the current request and writes that option new into the database. You registration doesn’t run on every request, so it doesn’t exist, when the option is rewritten. Register the rule on ever page load, flush the ...
When a plugin is activated, the only thing that runs on that activation request is the activation hook. whatever you've got hooked to init has not and will not run on that request, so you need to register it in your activation before you flush rewrites. it's only after the plugin is activated, on the next request, that the init action fires for that plugin.
Only top voted, non community-wiki answers of a minimum length are eligible