Is there a good tool to analyze my rewrite rules? I always get confused with the regexes and the parameter replacements.

I have created something myself and will post it here so others can use it, but please feel free to add other tools!

  • I don't understand the analyse part. For what should this be good for in concrete? just to read rewrite rules? that's the only plugin I'm aware of so far: wordpress.org/extend/plugins/askapaches-rewriterules-viewer
    – hakre
    Nov 4 '10 at 2:11
  • @hakre: Analyze and debug, in case you want to add a new rewrite rule but don't understand why it is not working. My current version for example also checks whether the query vars are read by WP::parse_request(). It is part of a larger effort to understand and maybe even improve the documentation of the rewrite engine.
    – Jan Fabry
    Nov 4 '10 at 10:34
  • Denis named an interesting aspect here: wordpress.stackexchange.com/questions/3431/… -- number of rules per post / page.
    – hakre
    Nov 5 '10 at 22:11

Well what a coincidence that you ask this, Jan! Just today I had time on a long train journey and decided to write a Rewrite Analyzer plugin, one that parses your rewrite rules and highlights the query variables. You can test URLs right there and see what query variables will be set.

Display all rewrite rules and highlight captured URL parts and ignored query variables

Test URLs and see matching rules with the resulting query variables

You can find it in the plugin repository, or just as Monkeyman Rewrite Analyzer when search for new plugins in your administration screen.

  • 1
    Nice would be to have that as an addition to the debug bar :)
    – kaiser
    Mar 21 '11 at 0:35
  • Is there an SVN the plugin can be pulled from?
    – t31os
    Apr 13 '11 at 16:45
  • 5
    Question, Jan: when something is crossed out in red, what does that mean exactly? Jun 24 '11 at 3:09
  • 2
    @Manny: Red query variables are not marked as public, so they will not be sent to the $wp_query object and you will have a hard time accessing them later.
    – Jan Fabry
    Jun 24 '11 at 11:13
  • 1
    @Cawas: I think it might still work. It has been a while since I did some serious WordPress work, but the code is very backwards compatible.
    – Jan Fabry
    Nov 12 '15 at 19:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.