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:

  1. 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.
  2. 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.
  3. 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.
  4. 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 way, if the worst happens, you can almost instantly roll back to a clean, working version of your site.

Plugin to export WordPress URLs

Install the Export All URLs plugin to get started.

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:

  1. CSV is readable by humans.
  2. The format is easy to edit and modify manually.
  3. 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:

The Export Data… screen.

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:

  1. Plain text doesn’t require specific software to edit its contents.
  2. It’s robust in the face of data corruption.
  3. 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:

Plain text file format.

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:

  1. With a plugin: The Export All URLs plugin is probably the best option for the majority of WordPress users.
  2. 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.

The post How to Export WordPress URLs (Using Two Different Methods) appeared first on Elegant Themes Blog.

Powered by WPeMatico

Canadian Web Hosting [Ad]

Canadian Web Hosting [Ad]