I created a function in functions.php that adds some rewrite rules:
function add_rewrite_rules() {
add_rewrite_rule('events/page/([0-9])*/?', 'index.php?pagename=events&paged=$matches[1]', 'top');
[...]
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
I would like to execute it every time any plugin is activated, so if the new rules get overwritten I can restore them automatically. Is it possible?
Thank you.