How to Get a List of WordPress PDF, Image, Post, or Page URLS

  • read

Below are two PHP scripts you can use to help get a list of URLs of content in your WordPress site. I use these when I am migrating posts or media library files to another sites without using a plugin.

Follow the steps below to use these scripts

  1. Open a text editor and copy and paste one of the code blocks and save the file as get-urls.php
  2. Upload the get-urls.php file to the root directory of your wordpress install not your themes folder
  3. In your browser go to

Get List of Attachments

Once you have your list of URLS you can use this handy chrome extension to download them into a folder.


Get List of Pages

Regex Find and Replace Old domain with New One


Written by: Jacob Lett, a website designer & developer who creates HubSpot CMS themes and writes web design & marketing books to help marketers, designers, and web developers grow their businesses. This blog is my own personal journal and source to help others through some challenges I have faced.
Connect on LinkedIn

Category: Code Snippets
Tags: ,

Related resources

  • HubSpot CMS vs WordPress: Feature Comparison and Review
  • 25+ Questions to Ask Before Redesigning Your Business Website
  • 5 Things A Business Should Consider Before a Website Redesign
  • How to Get a Responsive Website for Your Manufacturing Company
  • What Is a Good WordPress Alternative for Businesses?