The official advice on flushing rewrite rules is on plugin activation and deactivation.
This advice does not work for multisite, where each site keeps its own cache of rewrite rules. Even if you called flush_rewrite_rules
on every existing site during plugin activation, this would not catch new sites added in future.
When should flush_rewrite_rules
be called from within a plugin to ensure all sites have the correct rules loaded on their first hit?