Something like this should do it, you may have to fiddle with the preg_replace()
to get it to work the way you need, but the concept (and, more importantly imo, the regex, is there).
if( is_single() ) {
add_filter( 'the_content', 'wpse44503_filter_content' );
}
function wpse44503_filter_content( $content ) {
$regex = '#src=("|\')'.
'(/images/(19|20)(0-9){2}/(0|1)(0-9)/[^.]+\.(jpg|png|gif|bmp|jpeg))'.
'("|\')#';
$replace="src="".get_site_url( $2 ).'"';
$output = preg_replace( $regex, $replace, $content );
return $output;
}
That’s untested, and I wrote it right into the solution box, so make sure you debug thoroughly and such.
Related Posts:
- Get uploaded image url
- How do I get a post author’s image/avatar via RSS from another blog?
- Server Path Information
- Can we have an ‘Update metadata’ button in Image Gallery for all image instances?
- Retrieving Meta from Image Attachment
- Setting up PubSubHubbub (PUSH) with WordPress
- Add ALT attribute to Pin It Button image to pass HTML5 validation
- Using arbitrary paths in page urls
- Make change in media library affect images in published articles
- Adding (image) caching to my Tumblr widget
- How to upload multiple files/images when developing a wordpress plugin?
- Image Manager Plugin [closed]
- Implementing an image hosting website using WordPress? [closed]
- How to reorder and display a feed to be chronological?
- Bulk Image Upload And Rerrange Functionality
- Redirect to another page using contact form 7? [closed]
- How to apply lazy loading in background images [closed]
- Woocommerce showing images blurry in description page
- Slider/text combination plugin
- Plugin to hide image in excerpt
- How to get path or root of plugin folder, not file or dir?
- Image change on hover
- How to write “alt” tag in image for wordpress code?
- Adding Static Image to WooCommerce Content-Single-Product template
- Slashes stripped in ACF
- In Woocommerce theme need to add custom external link [closed]
- Getting taxonomy images to display on single-post with their terms
- Photo Gallery Plugin and Touch Devices
- Image crop, resize and compression plugin?
- How to Resize the Custom Post Images?
- Plugin that will let me specify a number of image sizes?
- Which plugin can do horizontal scrolling of RSS feeds in WordPress [closed]
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Images under 1MB are not being compressed
- Skewed / slanted button within elementor [closed]
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Plugin for an interactive image? [closed]
- Clear out old images, any advice?
- How to fix broken media library?
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- How to get images using taxonomy ( WP Media Folder)
- adding Adsense’s In-Article Ads between images of blog post
- Add “Featured Image” box in my plugin post page
- Large amount image data transfer
- Correct Plugin File Path
- Hardcoded paths in my plugin
- WP RSS Aggregator plugins breaks after switch to HTTPS
- Best way to duplicate specific page content across two sites?
- Blurry images when loading the page first time
- Get Image Having the ID [closed]
- Image Galleries for website migrated from .com to .org
- Search by Attachment ID
- Overwrite add_image_size defined by theme
- Scrape a webpage for image and add it to post
- JSON API Plugin not showing Attachments id reused
- Featured Image in RSS Feed
- How do I link an image in my plugin so it displays on WordPress?
- Absolute paths in backend for plugins after moving wordpress
- Some images on WordPress site are suddenly gone
- Regenerate Thumbnails Plugin successfully updated my thumbnails but image src won’t change to new image size?
- Add_image_size not generating correct size
- Is there a way to insert multiple images into a post at the same time without using a gallery?
- how to convert XML from URL to HTML
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- Multiple images per post – Show random image elsewhere
- How can I add rel=”nofollow” attributes on RSS widgets?
- WordPress Following? Social Users?
- Looking for a photo management solution
- I’m having several WP issues, especially with missing images
- Simple sildeshow/image-upload plugin?
- Elementor Pro display featured image on section -> style -> image using shortcode
- Offer Download Links for Product Images
- Can export gallery but can’t import it Wp all import
- how to remove share button from image overlay
- How to hide featured images of all posts falling under the same category in wordpress?
- RSS feeds for specific topics
- Bulk Image Resize for Media Library, but for ENLARGING instead of Shrinking
- Optimal image size for wordpress?
- Copy/paste local images not working in WordPress
- Upload Image with a file URL and show dynamically on Frontend
- How to add height and width to images on a page(using WP Bakery) to improve Google’s CLS score?
- Is classical wordpress eidtor a good option for me to include a large table with a large number of images on my webpage?
- Enlarge an image slider when click
- Get all image in media Gallery with alt/title?
- insert og image link in wordpress post
- WordPress built-in compression of images? How well does it compare to Photoshop or Shortpixel?
- Is there a way to auto generate poster image for videos
- Optimise wordpress database using SQL after deleting registered images from Media Folder
- Display Multiple Photos as Featured Image when mouse moves on to it post
- Do images in plugins automatically load?
- How to Upload images to a custom folder in upload folder using media uploader
- I need to register and resize images, safe to delete plugin afterwards?
- Displaying all the images from all of my articles
- Include my files in a plugin? [duplicate]
- what functions to use to resize images and create DB metadata for them after/during upload?
- Product Page loads terribly slow when product gallery images are added
- On my WordPress 5.4 website, how to remove all feeds? Including Category and Tags
- Failed GET Request From admin.php To Fetch .min.js File From Unminifed Directory
- path of wp-content directory when we are on some plugin
- WP_get_image_editor resizing images in a foreach loop