WordPress: list all the URLs / routes

I want to see a list of all the (rewritten) URLs that my WP site is using. Basically, if you’re familiar with Rails, I want rake routes… but for WordPress.

If it matters, the reason is this. I’m writing code to exist next to an existing WordPress site and I keep bumping against a problem where my new code is accessible at the same URL that WordPress or one of it’s plugins is using. I keep having to monkey with the .htaccess file. It would be much easier to just see a list of every URL that’s taken and just avoid them.

Related posts

Leave a Reply

2 comments

  1. i’m new to wp, but i think you are after $wp_rewrite

    at the right hook do a:

    global $wp_rewrite;  
    print_r($wp_rewrite->rules);
    

    if nothing is printed, remove ->rules and print whole object

    hopefully a starting point 🙂

  2. A similar question was asked over at WordPress Answers, where several helpful suggestions are made, notably the use of a few plugins for this purpose:

    Neither have been updated in over 2 years, but I’ve just successfully installed them locally on WordPress 3.7.

    Ask Apache’s plugin installs and activates fine, but looks like some of the debugging info is outdated, and otherwise provides more detail than is useful for me.

    The Monkeyman Rewrite Analyzer provides a formatted & more interactive representation of [@gwillie's snippet][2]. Works for me!