Plugins rewrite rules the right way

The add_rewrite_rule function doesn’t change the database. Just an array in memory. It is not an expensive operation.

The alternative is to add code to detect whether your rule is there, which is actually more expensive than just modifying the array.

tech