Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Blogging & content · Info

Can You Replace a Media File in WordPress? The Short Answer

Can You Replace a Media File in WordPress? The Short Answer

Short answer

Yes, but core WordPress has no replace button for media files. Uploading a new version creates a separate file with a new address. To replace a file at the same address, use a plugin such as Enable Media Replace or overwrite it by FTP and regenerate thumbnails.

Key takeaways

  • Core WordPress cannot swap a media file for a new upload.
  • Enable Media Replace keeps the same attachment ID and address.
  • FTP overwrites work but image thumbnails need regenerating.
  • Clear page, browser and CDN caches after replacing files.
  • Changing the file name or type changes the file's address.

Can you replace a media file in WordPress?

Yes, but not with core WordPress alone; there is no built-in replace button in the Media Library, so most people use a plugin such as Enable Media Replace or overwrite the file by FTP.

WordPress treats every upload as a new item. Uploading an updated PDF or image creates a second file with a new address.

That is a problem when the old file is linked from many pages, emails or other sites. You want the new version at the same place.

This article explains what core can and cannot do, the safest way to replace files, and the side effects to watch for.

What can core WordPress do with an existing media file?

Core WordPress can edit an image by cropping, rotating, flipping or scaling it, and you can change the title, alt text, caption and description, but it cannot swap the file itself for a new upload.

Here is what is possible without a plugin:

TaskPossible in core?Where
Change title, alt text, captionYesMedia Library, Attachment details
Crop, rotate, flip or scale an imageYesEdit Image button on the image
Swap an image inside a blockYesReplace button in the Image block toolbar
Upload a new file to the same addressNoNeeds a plugin or FTP
Replace a PDF or video fileNoNeeds a plugin or FTP

The block toolbar's Replace button can confuse people. It changes which image the block shows, but the old file stays in the library and other pages still use it.

The WordPress.org guide to the Media Library screen lists the core editing tools.

How do you replace a media file with a plugin?

Install a media replace plugin, open the file in the Media Library, click the replace option, upload the new file and choose whether to keep the old file name or use the new one.

Enable Media Replace is the best-known free option. It adds an Upload a new file button to the attachment screen.

The typical flow is:

  1. Install and activate the plugin.
  2. Go to Media, then Library, and switch to list view.
  3. Hover over the file and click the replace link, or open the file's edit screen.
  4. Upload the new version.
  5. Choose to keep the same file name or rename and update links.
  6. Click Upload.

The attachment keeps the same ID. That means galleries, featured images and blocks that point to it keep working.

Other plugins offer similar features. Check reviews, the last updated date and compatibility before installing any of them.

Which replace option should you pick?

Keep the same file name when the old address is linked from outside your site, and use the new name with link updates when the old name is wrong or the file type has changed.

Keeping the name means every existing link now opens the new file. That is ideal for a price list PDF that customers bookmark.

Changing the name lets the plugin search your content and update links. Links on other websites or in old emails will still point to the old address.

Can you replace a file by FTP?

Yes; upload the new file with exactly the same name into the same uploads folder to overwrite it, but image thumbnails will not update until you regenerate them.

Files live in wp-content/uploads, sorted into year and month folders by default. Find the original file's path in the Media Library first.

This method works for any file type. It is useful when a file is too large for the uploader.

For images, WordPress creates several resized copies at upload. Overwriting the original does not touch those copies, so pages may still show the old picture.

Fix that with a thumbnail tool. The Regenerate Thumbnails plugin rebuilds sizes from the original, and the wp media regenerate command does the same from WP-CLI.

Learn WordPress also has a short lesson on regenerating thumbnails.

What problems can replacing a file cause?

The most common problems are visitors still seeing the old file because of caching, wrong image sizes in thumbnails, and broken links if the file name or type changes.

Watch for these side effects:

  • Browser and CDN caching: the old version may show for hours unless caches are cleared.
  • Image dimensions: a new image with a different shape can look stretched or cropped in some layouts.
  • File type changes: swapping a JPG for a PNG changes the file extension and the address.
  • Image optimization plugins: they may need to process the new file again.

Browsers keep copies of files to load pages faster. MDN's guide to HTTP caching explains why a replaced file can take time to appear.

Clear your page cache and CDN after replacing important files. Our guide on clearing cache in WordPress covers each layer.

Is it better to replace a file or upload a new one?

Replace the file when it is linked in many places or from outside your site; upload a new one when the content is different enough to deserve its own address or you want to keep the old version.

Replacing suits:

  • Updated PDFs such as menus, price lists and brochures.
  • Corrected images, such as a logo or team photo.
  • Files linked from emails, ads or other websites.

Uploading new suits:

  • A genuinely different document, such as a new year's report.
  • Cases where you need the old version for records.
  • Images that need new alt text and a new, descriptive file name for SEO.

If you upload a new file instead, update links across the site. Our guide on searching and replacing in the WordPress database explains how to change many links at once.

How do you prepare the new file before replacing?

Match the old file's dimensions and type where possible, compress images, give the file a clear name, and back up the site before replacing important media.

A few minutes of preparation avoid most problems.

  • Use the same width and height for images shown in fixed layouts.
  • Compress large images before upload. Our guide on optimizing images for WordPress shows how.
  • Keep PDFs small enough to open quickly on phones.
  • Take a backup, so you can restore the old file if needed.

Then check the pages that use the file. Look at them on desktop and mobile after clearing caches.

What if the upload fails when replacing a file?

Upload errors during replacement usually come from file size limits, server memory, permissions on the uploads folder or a plugin conflict, the same causes as normal upload errors.

Check the maximum upload size shown on the Media, then Add New Media File, screen. Larger files need a higher limit from your host or an FTP upload.

If the Media Library itself will not load, see our guide on fixing the Media Library not loading.

For image upload errors, our guide on fixing the HTTP error when uploading images walks through the usual fixes.

The short version stays the same. WordPress cannot replace files on its own, but a small plugin or a careful FTP upload does the job well.

Frequently asked questions

Does the Replace button in the Image block replace the file?

No. It only changes which image that block shows. The original file stays in the Media Library, and other posts that use it are not affected.

Will replacing an image keep its alt text?

With a replace plugin that keeps the same attachment, yes, because the title, alt text and caption belong to the attachment rather than the file. Review the alt text anyway if the new image shows something different.

Why do I still see the old image after replacing it?

Caching is the usual cause. Your browser, cache plugin, host or CDN may keep the old copy. Clear each cache, and regenerate thumbnails if you replaced the file by FTP.

Can I replace a PDF in WordPress and keep the same link?

Yes. Use a media replace plugin and choose to keep the same file name, or overwrite the PDF by FTP using the identical name. Every existing link then opens the new version.

Is it safe to delete the old file after uploading a new one?

Only after you have updated every link to it. Deleting a file that pages, emails or other sites still link to creates broken links and 404 errors.

Sources

  1. Enable Media Replace WordPress.org Plugin Directory
  2. Regenerate Thumbnails WordPress.org Plugin Directory
  3. Media Library screen WordPress.org Documentation
  4. wp media regenerate WordPress Developer Resources
  5. Regenerate thumbnails lesson Learn WordPress
  6. HTTP caching MDN Web Docs

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.