PDF migration

Question

  • Is there a method to migrate all PDF files?
    • Yes, you can export from phpMyAdmin
  • Is possible preserving the same paths?
    • Yes: with Export media plugin  using this method in will import all media files
    • Yes: Manually
    • Create Corresponding Paths: On your new site, create the same directory structure and paths as on the Kinstar site. This will ensure that the URLs remain consistent and functional.
    • Transfer PDF Files: Upload the PDF files from your Kinstar site to the corresponding paths on your new production site. You can use an FTP client.

Where are your pdf files stored?

Your media files are uploaded to the /wp-content/uploads/folder. Normally, the image is also placed inside a folder the month it was uploaded.

Where is data for your media files in the database?

Information about your WordPress pdf is stored in two database tables:

  • wp_posts: This table has one entry for each pdf, image. The entry contains the URL, caption, the upload date, and other key data.
  • wp_postmeta: This table contains multiple entries. These entries contain the image’s ALT text and information about different sizes of the image to show on different device sizes.

What is the post_mime_type value for PDF files?

The standard Media Type (formerly known as MIME types) is application/pdf

How to export pdf files?

				
					// SQL Browse

SELECT * FROM `wp_posts` WHERE `post_mime_type` LIKE 'application/pdf'
				
			

Prepare Import file

From CSV file you get all pdf as table. We have to combine its to one cell for one post. 

Edit file in the google spreadsheet

  • Add a new column in the left
  • =CONCAT("|", T2)
  • Enter the formula in T2, drag it down the column, and you will have the same text inserted in all cells.
  • Create a new sheet with title and attachment columns only.
  • Copy all values only paste into the attachment column.

Import file via WP import plugin

  • Import new post
  • Map fields
  • Title: title
  • Other Post Options: Download & Import Attachments 
    • Map with:  {attachment[1]}
    • Separate by ” | “
    • Check: Search for existing attachments to prevent duplicates in media library

Video

Update 10/2/26

Alternative: Use the WordPress Importer for the whole Media Library

On the old site, go to Tools → Export → Media to get an export file. On the new site, go to Tools → Import → WordPress, upload that file, and tick “Download and import file attachments.”

The importer places each file in the year/month folder of its original upload date, so the structure is preserved. It also keeps titles and descriptions. This option needs the old site to still be online.

Use AI tool to filtered your export file, so you don’t need to remove the images yourself. Just make sure PDFs are valid XML file.

Go to Tools → Import → WordPress, upload the file, and tick “Download and import file attachments.” The folders will be the same.

Option: Use the code below in console to list all pdf you will get the total number and link.
				
					(() => {
  const rows = document.querySelectorAll('#the-list tr');
  const urls = [...rows].map(row => {
    const dl = row.querySelector('a[download], .download a');
    const copyBtn = row.querySelector('[data-clipboard-text]');
    return dl?.href || copyBtn?.dataset.clipboardText || null;
  }).filter(Boolean);

  const unique = [...new Set(urls)];
  console.log(`Found ${unique.length} URLs:\n` + unique.join('\n'));
  copy(unique.join('\n')); // copies the list to your clipboard
  return unique;
})();
				
			
More Resources

Suggest solution from Kinstar support is use duplicate plugin but it doesn’t work on my case.