How to move files from Bunny Storage back into WordPress

When managing a WordPress site, there might come a time when you need to move media files that were offloaded to Bunny Storage back onto your WordPress server. This guide will walk you through the steps to safely and effectively migrate your media files back to WordPress, ensuring the integrity of your media and website functionality.

Step 1: Copy Files from Bunny Storage

The first step involves copying your media files from the Bunny Storage Zone back to your WordPress server. It's crucial to maintain the original directory structure to ensure that WordPress can correctly locate and serve these files.

WordPress automatically generates multiple subsizes of each uploaded image to serve optimized versions based on the context. When copying your files back, ensure you include these subsizes. They are usually named according to the pattern filename-widthxheight.extension. For example, for cat.jpg, you might find subsizes like cat-300x200.jpg and cat-1024x768.jpg.

To identify which subsizes exist for a particular file, use the following SQL query on your WordPress database, replacing 123 with the relevant post ID:

SELECT meta_value FROM wp_postmeta WHERE meta_key = '_wp_attachment_metadata' AND post_id = 123;

 

Step 2: Update WordPress Database

After copying the files, you need to update the WordPress database to reflect the change. Specifically, you should remove the _bunnycdn_offloaded entry from the wp_postmeta table for each file you're moving back. This entry indicates that the file was offloaded to Bunny Storage, and removing it tells WordPress the file is now stored locally.

Execute the following SQL query for each file, again replacing 123 with the appropriate post ID:

DELETE FROM wp_postmeta WHERE meta_key = '_bunnycdn_offloaded' AND post_id = 123;

 

Step 3: Repeat for All Files

Repeat steps 1 and 2 for each file you wish to move back to your WordPress server. It's important to go through the files individually to ensure that the WordPress database accurately reflects the location and status of each media file.

 

Congratulations! You've successfully moved your media files from Bunny Storage back to your WordPress server. Your website should now be serving these files directly from your server, ensuring optimal performance and control over your media assets. Remember, it's always a good idea to double-check your site to ensure everything is working as expected and to make any necessary adjustments.

 

Need Help or Encountered Issues?

If you encounter any difficulties or have questions while following this guide, our support team is here to assist you. Please don't hesitate to contact us via support request form for prompt assistance.

Table of Contents

Was this article helpful?
0 out of 4 found this helpful