Migrating your WordPress site to a new host, or setting up redirects, are common practices for thoseย who run into problems with their hosting provider or site structure. Theyโre just two of many scenarios in which you would need to export WordPress URLs.
Fortunately, there are a number of free plugins and tools to help you get the job done. In this post, weโll explain why youโd need to export your WordPress URLs,ย thenย show you how to do itย using two different methods. By the time weโreย done, youโll be able to export WordPress URLs with aplomb!
What WordPress URLs Are and Why You Would Need to Export Them
For the uninitiated, WordPress URLs (also called โpermalinksโ) are the unique links to yourย content, and setting them up correctly has a number of Search Engine Optimization (SEO) benefits. Whatโs more, WordPress is more than just a powerful Content Management System (CMS). It also comes bundled with a handy toolkit of its own that enablesย you to undertake maintenance-related tasks without having to get into a single line ofย code โ includingย exporting your WordPress URLs.
So, why would you need to export your siteโs URLs? There are a number of scenarios whereย youโll find youโll need a complete list.ย For example:
- Migrating your WordPress site:ย If youโd like to migrate your WordPress website without affecting yourย SEO, youโll have to update the URLs ahead of time.
- Moving your site from a localhost installation to a live installation:ย When itโs time to launch your site, you may need to modify yourย URLs to reflect your live domain.
- Setting up redirects:ย If youโd like the traffic from one page to be sent to another, youโll need to redirect yourย WordPress URLs to the new link.
- Sharing URLs with your SEO team:ย Itโs a common practice, and you may need to update your URL structure as a result. Itโs a similar case with setting up tracking with SEO tools.
With that brief overview out of the way, letโs dive right into the tutorial! Weโll start out by walking you through the process of exporting WordPress URLs using a plugin (the easy way), then show you how you can do the same manually (the hard way).
How to Export WordPress URLs Using a Plugin
Itโs always a good idea to make a backup of your website before tinkering with yourย siteโs core files (thatโs easy using a WordPress backup plugin). That way, if the worst happens, you can almost instantly roll back to a clean, working version of your site.
Once youโre fully backed up, youโll want to install a suitable plugin โ weโre usingย Export All URLs. This plugin offers a quick and easy solution to extract the URLs, titles, and categories of your posts and pages. For ourย purposes, weโre only interested in exporting WordPress URLs.
Exporting to CSV
Theย Comma Separated Values (CSV)ย format is generally used to store tabular information. This data is usually exported to a spreadsheet file (such as Microsoft Excel) with one record per line.
CSV files should be used when you already understand the structure of your data. In this case, we know that weโre only exporting WordPress URLs, which makes exporting to CSV a good choice. Here are some additional benefits:
- CSV is readable by humans.
- The format is easy to edit and modify manually.
- Almost all existing applications support the CSV file format.
How to Export Your URLs in CSV Format
Firstly, log in to your WordPress siteโs admin panel, then navigate to Settings > Export All URLs. Atย the nextย screen, select the following options:
- Select a Post Type to Extract Data:ย All Types (pages, posts, and custom post types).
- Additional Data: URLs.
- Export Type: CSV.
Finally, click the Export button to export the URLs in CSV format:
Once exported, a notification will be displayed with a link to download the data. Once you download the file, itโll display a list of your siteโs URLs.
Exporting to Plain Text
Plain text is simply a format that doesnโt have any tags or special formatting in place โ itโs data that isnโt written in code under the hood.
The obvious benefit of exporting to plain text is that itโs incredibly easy to read by humans, especially when offered in an HTML orย XML file. Aside from this, there are a few other reasons you may wantย to export to plain text:
- Plain text doesnโt require specific software to edit its contents.
- Itโs robust in the face of data corruption.
- It enablesย different programs to access each otherโs files.
Howย to Export Your URLs in Plain Text Format
Similarly to exporting to CSV, log into your WordPress siteโs admin panel, then navigate to Settings > Export All URLs. At the nextย screen, select the following options:
- Select a Post Type to Extract Data:ย All Types (pages, posts, and custom post types).
- Additional Data: URLs.
- Export Type: Output here.
Finally, click the Export button to export the URLs:
Once exported, the URLsย will be displayed below yourย settings, where you canย copy and paste themย into your favoriteย text editor.
How to Export WordPress URLs Manually
Although using a plugin produces good results, you may want to export your URLs manually โ at the very least, youโre saving potentially valuable resources.ย For this method, youโll need access to a File Transfer Protocol (FTP) client โ we recommend the open-source FileZillaย โย or use the File Managerย in cPanel. If youโre new to FTP, find a good tutorial, and brush up on your skills before starting โ and donโt forgetย to create a backup of your WordPress website before you begin!
To get started, create a new file on your computer,ย and enterย the following code (based on a Bloggersignal snippet) encased within PHP tags:
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}"; }
Next, save the file as a .php file and name it exported-urls.php. Once saved, log into your FTP client using theย credentials provided by your host, navigate to your root directory (normally called www or public_html), thenย upload theย exported-urls.phpย file.
Once complete, navigate toย http://www.yoursite.com/exported-urls.php in your browser, where youโll seeย a list of your exportedย URLs.ย From there, you can copy the linksย as normal.
Conclusion
Exporting your WordPressย URLs is a common task, especially for migrating your site or setting up redirects โ but for some it could be difficult. Thereโs a method available for any level of technical expertise, and in this post, weโve walked you through two different ways to achieve it:
- With a plugin:ย The Export All URLs plugin is probably the best option for the majority of WordPress users.
- Manually: Exporting URLs manually with anย FTP client or the File Manager in cPanel is ideal for those who are comfortable with code.
After reading this piece, you should now be in a good position to export your own WordPress URLs.
Do you have any questions about how to export your WordPress URLs? Subscribe to the conversation, and let us know in the comments section below!
Article thumbnail image by harper kt / shutterstock.com.
This worked perfectly with php method. The plugin gave me errors. Is there a modification I could make to php that would also echo a column to identify if it is a post or a page?
Thanks for the info. Always love coming to the blog ?
It can help other people who wants to know how to Export WordPress! KEEP UP the GOOD work! ๐
Thank you! It gave me knowledge. Hoping to see your next post!
It gave me knowledge! Wishing to see one of your posts again!
It was a nice knowing this Export URLS!
Thanks for the kind words, Nico!
I was succesful on “Export All URLs” plugin method. Thank you very much for sharing that.
No problem, Rayhan!
You can also use screaming frog
Thanks for the tip, Bulut. ๐
Thanks ?
No problem, Ylem. ๐
Great article. I have a question…I am using http for now at my web page. Should I condiser moving to https or is it to sson?
Switching to HTTPS is never too soon. Do some research, though โ you could introduce further problems if you’re not careful.
Thanks for your question. ๐
The plugin allows you to export URLs, title, categories. There is also an option to either export this data in a CSV file or display it right on the settings page.
Steve
Nice. Didn’t know it would be this easy to aggregate all urls and export ๐
Well, now you do James. ๐
Hi everyone
How can I insert urls, from HTML web pages into WordPress. Or from other web systems. Or rather, no Wordoress convert websites into a WordPress page.
I’m missing something (big): now that one knows how to export the URL’s can you please tell us how to actually USE the exported URL’s in support of each of the scenarios you mention?
That, Jon, is a subject for another article! It was slightly outside of the remit for this one, but we’ll look to write up something about importing another time.
Thanks for your comment. ๐
Sorry I’m with Jon here – what next? For every export there is a corresponding import?
Yes, I also would like to know how to USE the exported URLs in the four scenarios mentioned.
Yes, I also don’t understand what you need the list of URLs for, or how to use them. Thanks.
Thank you ๐
You have done a very nice expression, probably worth a try ๐
You can also use screaming frog ๐
Thanks for the suggestion, John-Pierre. ๐
Migrating a website from one platform to another is a little tough job and when we migrate our blog/website from wordpress to other CMS we had to export our WP URLs. Here you have described the full method very easily and effectively which will help newbie bloggers to migrate their blogs. Really great guide. Thanks for sharing the information added beautiful guide here.
Hi Jhon,
I have a site created with Divi, but expired the domain name that I used for this site.
Then, I bought a new domain name,
I want to know:
How to can I use the files the this site with the new domain name?
do you have any recomendations for me?
thanks in advance!
Guillermo, you’ll want our article on Duplicator. You can use it to migrate your website (https://www.elegantthemes.com/blog/tips-tricks/duplicator-an-easy-way-to-back-up-copy-or-clone-your-wordpress-content).
Hope this helps. ๐
If you have ssh access to your site install wp-cli from https://wp-cli.org/
and do:
wp search-replace ‘http://old-domain.com’ ‘http://new-domain.com’
Guillermo,
I have a similar situation. Would love to know what you end up doing…
LOVE this php file! Great for redirect logs. Thanks.
I get urls from sitemap.xml ๐
Thanks for the additional tip, Javier. ๐