Rewrite rules in multisite

Found the answers:

  1. There is nothing to do when using the Rewrite API that isn’t written in the Codex.
  2. Rules written using add_rewrite_rule are not added to .htaccess. WP adds them to its database under rewrite_rules in the _options table.

It’s important not to forget to:

  • Filter the rewritten permalinks; call the functions on the post_type_link hook and/or the term_link hook depending on the situation.
  • Remove default rules to avoid conflict and call the function/s on the rewrite_rules_array hook.
  • Flush and rewrite the rules using flush_rewrite_rules(); on plugin activation and/or deactivation.

Leave a Comment