Fastest way in my opinion would be to apply filter on the_content
with preg_replace_callback
to find media URLs and replace them with anything else, like attachment pages. Attachment ID is available as part of <img>
class value as well as wp:image
attribute in Gutenberg comment. So you just need some smart regexp to match each image block in content and replace it. No undo needed. However this is maybe not the best solution performance wise, as replacents will be done on each page request (unless caching is used).
Better solution would be to run some PHP code once (wp-cli command or otherwise) to loop over all posts and replace post_content value with replaced URLs. Save DB backup before this for undo or create reverse replacement function as well.
Related Posts:
- How to extend the gallery block in Gutenberg?
- Set default image link target in Gutenberg image block
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- get_post_gallery with Gutenberg
- How to include externally hosted images into a gallery block
- Apply image width to tag
- How to link Gutenberg Gallery images To Media file automatically?
- How to Add extra option to Image Block Settings?
- @wordpress/create-block image url in css
- How to remove buttons from gutenberg toolbar
- Extend core block attributes in post content
- Gutenberg editor get post featured image by id
- hardcrop images in gutenberg “latest posts” block
- Trying to create a mouseover effect in html using Gutenberg editor
- Prevent Image Pasting in RichText Component
- Multiple amp-image overlays. How to properly do this in wordpress?
- Update an image block style programatically
- Add width & height attributes to Gutenberg’s image output?
- update_post_meta attachment_image_alt description for Gutenberg
- Bulk-add featured images in posts with no featured image
- How to get the Gallery form/section just like in Gutenberg block?
- Is there a wordpress filter to edit the markup of inline images?
- How to upload and style svg logo?
- Weird failing request
- How can I check if the first block is an image aligned left or right?
- Not seeing text alignment option in Image block
- Doing a bulk replace of images through back-end
- Place image caption outside of figure tag (Gutenburg Image Markup)
- Change Image Size option in the settings in bulk
- How to disable a WP Image Block to link to itself?
- get_post_gallery with Gutenberg
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Using srcsets in a custom block
- Rebuilding core image block
- A query to substitute images paths in gutenberg (website migration)?
- Convert multiple image blocks to gallery block in Gutenberg?
- get_post_gallery with Gutenberg
- Custom filename when pasting an image from clipboard
- Multisite image URLs incorrect in editor
- Gutenberg block HTML image rendering override
- Edit multiple posts featured image
- How to automatically add rounded corners to thumbnails?
- show author image in posts
- How to limit number of images being printer out in “Set Featured Image” pop up?
- Replace Woocommerce Images
- Pasting images removes class attribute
- How can I make all gallery images to open in a new window?
- Crop image without scaling or resizing with add_image_size()
- Is there a way to pull the first featured image in a loop and not all other featured images?
- how to stop generating different image sizes from parser
- Change the URL of an image from wp_get_attachment_image_src
- Do I need to resize an image to fit the post?
- Link to large image version instead of original?
- alt tags of the images are not saving/emtpy
- Removing height and width from images with a caption
- Extracting gallery images in WordPress 3.5 on index.php
- How to get the url of an Image with id
- Image auto resize
- Retrieve images from parent site to child site using current shortcodes
- Add a background image for Custom Post Type archives page
- Background-image not showing? [closed]
- Scaling an image in a WordPress post
- Setup Featured image on all posts from thesis thesis_post_image custom field?
- Alter image meta fields in the Media Library
- Stop WordPress from cropping images using url parameters
- Add clickable link on an image
- How do you import images from a URL in your post?
- Multiple post image, echo url (path of image)
- How do I get a smaller size of an avatar image
- When the new post which has no image published, save the specific image as the featured image ( by category )
- download link for uploaded images for wordpress
- How do I link a featured photo to it’s post?
- How to get the title of the random images from media library?
- How to indent pictures on WordPress blog? [closed]
- Image and shortcode not showing in excerpt
- What is the plugin to import image from URL?
- How to enlarge thumbnail on mouseover?
- User uploads image as “Featured Image” but WordPress resizes it?
- Hide Title tag on image Hover
- Images not showing after wordpres update 5.6
- How to get the best resolution of image from srcset
- Images names not inserting in WordPress Database from Dynamic Add / Remove fields
- Images do not show in the website, but they appear on new tab
- featured image in custom poste type (backend)
- Image Uploader Doesn’t Open Modal in Widget
- Image linking and lightbox
- Which tools should I use for a gallery that uses an API and url for the path of the images?
- Uploaded images appear broken in WP 4.4
- How to best adjust images to a max content width of 490px?
- Get attachment images does not return any attached images
- attachment.php & flexslider—linking thumbnail to specific image
- Add two images with Sweet Testimonials
- Breadcrumbs for Single Image page
- WordPress Images | How to get the cropped image?
- Import existing image as a single post
- How can i make like this structure?
- Media Library is not loading on grid view in admin panel
- How can I put pictures next to each other and how can I add a location? [closed]
- Media upload error
- Featured Image not displaying [closed]