/ / Fixing some old media library folder problems in WordPress

Fixing some old media library folder problems in WordPress

One of the WordPress websites we manage had a legacy media library problem. There were thousands of files in the uploads folder and they weren’t sorted into years and months or any other subfolders. This is not ideal, and resulted in some performance problems, and we’ve been contemplating how to manage this for some time. The goal was to:

  • sort the files into subfolders
  • ensure that the displayed instances of the images and PDFs in pages and posts continued to be properly referenced
  • ensure that the media library continued properly index the assets

Also, we didn’t want to have to do this manually. We were looking for ways to do this that was automated and reliable, and we’re not MySQL experts.

Solution: WordPress Media Library Folders

Our first experiments using WordPress Media Library Folders failed actually. But, we hit reset on our attempts and it seemed to work our next time through. Here is roughly what we did.

Made a complete site backup, and also downloaded a copy of the uploads folder. Then added and activated the Media Library Plus plugin. Our first problem was that the images in the uploads folder weren’t showing up. So we experimented using the SYNC option. Worked well with experiments, so I tried syncing the main uploads folder. It ran for twenty minutes.

The sync finished and roughly 500 files showed up. So moved them into an arbitrary subfolder using year and month. That took quite a while. Now I am running the sync again on uploads to see what I can get to show up. Impressed with the way the database is updated with the new file structure. The premium version of this plugin is likely worth it, but we haven’t had to use it yet.

Similar Posts