Last Updated on
I recently had a apply a 301 redirect to about 20 post on a small WordPress site.
As you might already know, there are many easy to use 301 redirect WordPress plugins so all I needed was a list of all the posts on the site.
Why oh why? No WordPress post list in the database!
So the first place I looked was the database.
I thought I could just export the entire post URLs from there but that was not possible because there simply isn’t a table in the database that list the URLs with permalink.
My next thought was there must be a plugin. As it turned out, there is a very old plugin that seems to do what I was hoping it would do.
After checking on the web further, I managed to find a simple solution thanks to this forum post on WordPress.org.
The solution to list all post URL in WordPress
Essentially, here are the steps.
1) Copy and paste the following code in a new text file.
2) Then save it with “.php” extension such as “postlist.php” and upload it to the “wp-content” sub-folder.
3) Open it up in the browser http://yourwebsiteurl.com/wp-content/postlist.php
Nice and simple!
while (have_posts()) : the_post(); ?>
<?php the_permalink(); ?>|<?php the_title(); ?>|<?php the_tags(); ?>
<?php endwhile; ?>