How to Get a List of All WordPress Post URLs

For some reasons you might need to get a list of WordPress post URLs to work with.

But WordPress doesn’t have any local function to record all the publish, web page and customized post URLs.

Definitely, you can duplicate personal URLs, but that strategy is time-consuming and is also really undesirable.

So, if you ever need, here is how you can have a list of all the WordPress publish URLs using a simple code and a plugin.

Get a List of URLs Manually

To manually get a list of all the post URLs in your WordPress site, create a new file into your site’s root directory named export.php and open it.

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

<?php

include "wp-load.php";

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

$posts = $posts->posts;

header('Content-type:text/plain');

foreach($posts as $post) {

   switch ($post->post_type) {

       case 'revision':

       case 'nav_menu_item':

           break;

       case 'page':

           $permalink = get_page_link($post->ID);

           break;

       case 'post':

           $permalink = get_permalink($post->ID);

           break;

       case 'attachment':

           $permalink = get_attachment_link($post->ID);

           break;

       default:

           $permalink = get_post_permalink($post->ID);

           break;

   }

   echo "\n{$permalink}";

   //echo "\n{$post->post_type}\t{$permalink}\t{$post->post_title}";

}

?>

Once done, open up your browser and enter the URL – http://yourdomain.com/export.php in the address bar.

Now the uploaded file will be executed with the list of all the post URLs in your WordPress site.

Wordpress post URL

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

Get a List of URLs with Plugin

The other way around is to use a easy plug-in known as List all URLs which is available in the formal WordPress repository.

You can set up it like any other WordPress plug-in and once set up, start “List all URLs” configurations web page under the “Settings” category.

Now choose the radio keys according to your specifications also choose the check box “Make the generated list of URLs clickable hyperlinks” if you want clickable hyperlinks.

You can chose the option “All URLs” so that “List all URLs” can place the URLs of all the content, webpages and custom post types.

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

That’s all to do and it is so easy to list all the URLs in a WordPress website.

You may also like to know how to  download media library in WordPress. So, do check it out.

Give your opinion below if you experience any issues or to discuss your ideas and experiences.