59

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!

3
  • 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
    Commented Nov 4, 2010 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
    Commented Nov 4, 2010 at 10:34
  • Denis named an interesting aspect here: wordpress.stackexchange.com/questions/3431/… -- number of rules per post / page.
    – hakre
    Commented Nov 5, 2010 at 22:11

1 Answer 1

104

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.

7
  • 1
    Nice would be to have that as an addition to the debug bar :)
    – kaiser
    Commented Mar 21, 2011 at 0:35
  • Is there an SVN the plugin can be pulled from?
    – t31os
    Commented Apr 13, 2011 at 16:45
  • 5
    Question, Jan: when something is crossed out in red, what does that mean exactly? Commented Jun 24, 2011 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
    Commented Jun 24, 2011 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
    Commented Nov 12, 2015 at 19:27

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