{"id":5024,"date":"2025-09-18T16:45:03","date_gmt":"2025-09-18T14:45:03","guid":{"rendered":"https:\/\/wpmastertoolkit.com\/?p=5024"},"modified":"2025-09-18T16:46:49","modified_gmt":"2025-09-18T14:46:49","slug":"wpmastertoolkit-2-11-0-nouveau-module-media-replacement-remplacer-un-media-sans-casser-les-liens","status":"publish","type":"post","link":"https:\/\/wpmastertoolkit.com\/en\/wpmastertoolkit-2-11-0-new-media-replacement-module-replaces-media-without-breaking-links\/","title":{"rendered":"WPMasterToolKit 2.11.0 - New Media Replacement module (replace media without breaking links)"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Version summary<\/h2>\n\n\n\n<p><strong>Version :<\/strong> 2.11.0<br><strong>Module added :<\/strong> Media Replacement<br><strong>Objective:<\/strong> replace any media file with a new version while preserving <strong>media ID, file name and publication date<\/strong> - your existing URLs, integrations and links continue to work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why this module is important<\/h2>\n\n\n\n<p>Updating a PDF, logo, product image or font without breaking the pages that reference it is a real headache in WordPress. The <strong>Media Replacement<\/strong> solves this problem: you upload the new version, we replace the <strong>in the same location<\/strong>then we <strong>regenerating pruning<\/strong> and <strong>update metadata<\/strong>. Result: no 404s, no links to correct, no content to republish.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concrete changes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In-place replacement<\/strong> copy the new file over the old path (<code data-no-auto-translation=\"\">get_attached_file()<\/code>).<\/li>\n\n\n\n<li><strong>Keeping references<\/strong> : even <strong>ID<\/strong>, <strong>slug\/identical new name<\/strong>, <strong>date<\/strong> and <strong>permalinks<\/strong>.<\/li>\n\n\n\n<li><strong>Strict control of file type<\/strong> the mimetype must <strong>correspond<\/strong> (image \u2194 image, PDF \u2194 PDF, etc.) to avoid inconsistencies.<\/li>\n\n\n\n<li><strong>Automatic regeneration<\/strong> : <code data-no-auto-translation=\"\">wp_generate_attachment_metadata()<\/code> + <code data-no-auto-translation=\"\">wp_update_attachment_metadata()<\/code> to rebuild all <strong>subsizes<\/strong> (thumbnails, medium, large, etc.).<\/li>\n\n\n\n<li><strong>Reliable cleaning<\/strong> : delete old variants via <code data-no-auto-translation=\"\">wp_delete_attachment_files()<\/code> and forced file deletion if necessary (including images) <strong>-scaled<\/strong>).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">User path (in 3 clicks)<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Media library<\/strong> \u2192 hover over an item and click <strong>Replace media<\/strong> (line action)<br><em>(also present in the sidebar of the attachment page and in the media modal)<\/em><\/li>\n\n\n\n<li><strong>Drag and drop<\/strong> or <strong>select<\/strong> the replacement file.\n<ul class=\"wp-block-list\">\n<li>The module displays <strong>Type<\/strong>, <strong>Size<\/strong> and - for images - <strong>Dimensions<\/strong> of the old and new files.<\/li>\n\n\n\n<li>UI safeguards check <strong>max size<\/strong> the site and <strong>identical mimetype<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Replace<\/strong>. Replacement is instantaneous and your pages remain intact.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Technical details (for the curious)<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Hooks &amp; UI<\/strong>\n<ul class=\"wp-block-list\">\n<li><code data-no-auto-translation=\"\">media_row_actions<\/code> add action <strong>Replace media<\/strong> in the list.<\/li>\n\n\n\n<li><code data-no-auto-translation=\"\">attachment_fields_to_edit<\/code> &amp; <code data-no-auto-translation=\"\">attachment_submitbox_misc_actions<\/code> button in the media + modal file.<\/li>\n\n\n\n<li>A <strong>submenu<\/strong> hidden under <code data-no-auto-translation=\"\">upload.php<\/code> manages the dedicated UI (before\/after preview).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Security<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Nonce<\/strong> specific to each action.<\/li>\n\n\n\n<li><code data-no-auto-translation=\"\">wp_check_filetype_and_ext()<\/code> + blocking if type differs (except role with <code data-no-auto-translation=\"\">unfiltered_upload<\/code>).<\/li>\n\n\n\n<li>Input validation (<code data-no-auto-translation=\"\">sanitize_text_field<\/code>, <code data-no-auto-translation=\"\">is_uploaded_file<\/code>upload error handling).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Replacement &amp; cleaning<\/strong>\n<ul class=\"wp-block-list\">\n<li>Delete existing files (including sizes and backups) then <strong>copy<\/strong> from the new file to the <strong>same path<\/strong>.<\/li>\n\n\n\n<li>Case management \"<strong>-scaled<\/strong>\"and multilingual plug-in protection (e.g. locked files) with a <strong>hard suppression<\/strong> in fallback.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Performance &amp; WPMTK philosophy<\/strong>\n<ul class=\"wp-block-list\">\n<li>Like all WPMTK : <strong>loaded only if activated<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Typical use cases<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PDF<\/strong> update a brochure without changing the URL shared with customers.<\/li>\n\n\n\n<li><strong>Logo\/Charte<\/strong> Refresh a globally used logo (header, footers, builders) without editing the pages.<\/li>\n\n\n\n<li><strong>E-commerce images<\/strong> Adjust a product photo referenced in hundreds of files.<\/li>\n\n\n\n<li><strong>Fonts\/ICONS<\/strong> replace a static file referenced by theme or builder.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Limits &amp; best practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Strict mimetype<\/strong> you can't replace a <strong>JPEG<\/strong> by a <strong>PNG<\/strong> (or a <strong>PDF<\/strong> by a <strong>DOCX<\/strong>). Keep the <strong>same type<\/strong>.<\/li>\n\n\n\n<li><strong>Maximum size<\/strong> respect for <strong>upload limit<\/strong> of the site (verified in UI).<\/li>\n\n\n\n<li><strong>Cover<\/strong> if a CDN is in place, purge\/wait for propagation to see the new version everywhere.<\/li>\n\n\n\n<li><strong>Image dimensions<\/strong> If you change the dimensions radically, the appearance may vary where the image is integrated. Check your models.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick guide (step-by-step)<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Media \u2192 select media \u2192 <strong>Replace media<\/strong>.<\/li>\n\n\n\n<li>Upload a file <strong>of the same type<\/strong>.<\/li>\n\n\n\n<li>Check preview, size and (if image) dimensions.<\/li>\n\n\n\n<li>Confirm: <strong>Replace<\/strong>. Visit <strong>miniatures<\/strong> are regenerated automatically.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Safety notes &amp; compatibility<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Systematic nonces and server validation on all actions.<\/li>\n\n\n\n<li>Compatible with Media Library (list, modal, card) and native admin.<\/li>\n\n\n\n<li>Designed to cohabit with multilingual plugins and custom sizes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Version 2.11.0 brings <strong>major UX update and maintenance<\/strong> end broken URLs when replacing files. Activate the <strong>Media Replacement<\/strong> and update your media securely, without friction and without technical debt.<\/p>","protected":false},"excerpt":{"rendered":"<p>Version summary Version: 2.11.0Added module: Media ReplacementPurpose: to replace any media file with a new version while preserving the media ID, file name and publication date - your existing URLs, integrations and links continue to work. Why this module is important Updating a [...]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5024","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/posts\/5024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/comments?post=5024"}],"version-history":[{"count":2,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/posts\/5024\/revisions"}],"predecessor-version":[{"id":5026,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/posts\/5024\/revisions\/5026"}],"wp:attachment":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/media?parent=5024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/categories?post=5024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/tags?post=5024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}