How to Get a List of All WordPress Post URLs


Whenever you are developing a WordPress website or when you want to redirect a bunch of URLs at the same time or for whatever reason, you may need to get a list of URLs to work with.

But WordPress doesn’t have any native feature to list all the post, page and custom post type URLs.

Sure, you can copy individual URLs, but that approach is time-consuming and is also terribly inconvenient. So, if you ever need, here is how you can list all the WordPress post URLs using a simple code block and a plugin from the official WordPress repository.

Get a List of URLs Using a Plugin

The other way around is to use a simple plugin called List all URLs which is available in the official WordPress repository.

1. You can install it like any other WordPress plugin and once installed, open “List all URLs” settings page located under the “Settings” category.

2. Now select the radio button according to your requirements and also select the checkbox “Make the generated list of URLs clickable hyperlinks” if you want clickable links.

3. As you can see, I’ve selected the option “All URLs” so that “List all URLs” will list the URLs of all the posts, pages and custom post types.

List WordPress URLs - Select All URLs Option
List WordPress URLs – Select All URLs Option

4. Once you click the “Submit” button, the plugin will process all the URLs and will display them accordingly.

List WordPress URLs - WordPress Post URLs Listed using Plugin
List WordPress URLs – WordPress Post URLs Listed using Plugin

Get a List of URLs Manually Without Installing a Plugin

1. To manually get a list of all the URLs in your WordPress site, create a new file with the name export.php and open it.

2. Once opened, copy and paste the below code into that file and save it.


include "wp-load.php";

$posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;

foreach($posts as $post) {
    switch ($post->post_type) {
        case 'revision':
        case 'nav_menu_item':
        case 'page':
            $permalink = get_page_link($post->ID);
        case 'post':
            $permalink = get_permalink($post->ID);
        case 'attachment':
            $permalink = get_attachment_link($post->ID);
            $permalink = get_post_permalink($post->ID);
    echo "\n{$permalink}";
  //echo "\n{$post->post_type}\t{$permalink}\t{$post->post_title}";

3. Now login to your site’s FTP account using FileZilla or any other equivalent FTP software. Once logged in, upload the newly created file into your site’s root directory.

List WordPress URLs - Upload Export.php File using FTP Client
List WordPress URLs – Upload Export.php File using FTP Client

4. Once the file is uploaded, fire up your browser and enter the URL – in the address bar.

5. Now the uploaded file will be executed and you will get a list of all the post URLs in your WordPress site.

List WordPress URLs - All WordPress URLs listed
List WordPress URLs – All WordPress URLs listed

By default, the above code is set in a way that it only displays the post URLs and ignores other things like “post type” and “post title.” If you want them, just comment out the line 27 and uncomment the line 28 and you are good to go.

Note: don’t forget to delete the uploaded file as soon as you are done using it. This action helps in restricting others from any unauthorized access.

That’s all there is to do and it is that simple to list all the URLs in a WordPress site.

Hopefully that helps and do comment below if you face any problems or to share your thoughts and experiences.

Thanks to MikeSchinkel for the code.


  1. Helpful post, however, that plugin hasn’t been updated in 4 years… yet this post seems to be updated/republished Feb 2017…

  2. I couldn’t do this on the live server for a number of reasons, but my local site contains all of this information as it uses the same database. So I just added your script to an export-template.php and created a new page using said template. Worked like a charm. Thanks for the script!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.