You can use the_content
filter to filter all post content and replace img sources.
add_filter( 'the_content', 'show_full_sized_images' );
/**
* Replaces all -600x999 images with full image url
* @param string $content
* @return string
*/
function show_full_sized_images( $content ) {
$pattern = '~(http[^\'"]*)(-600x[0-9]{2,4})(\.jpe?g|png|gif)~i';
$m = preg_match_all( $pattern, $content, $matches );
echo '<pre>' . esc_html( print_r( $matches, 1 ) ) . '</pre>';
return preg_replace( $pattern, '$1$3', $content );
}
You’ll also need to add following css because width may be limited by width
attribute in img
tag:
img {
width: auto;
height: auto;
}
Related Posts:
- How to change image type for specific size?
- Maintaining image color and quality when uploading using custom sizes
- Mixed content warnings after changing site adress from HTTP to HTTPS
- add_image_size() zoom-crop
- Upload Image Not accessible
- Which are precisely the predefined image sizes?
- Caption in Page adding unwanted 10px to width
- Adjust image caption within visal editor
- Change Image URL to a CDN
- Slider image issue in wordpress
- How to add a media with PHP
- Responsive Images – Add srcset attributes to custom Images Function
- Getting custom size image URL
- Retrieving images from a NextGEN gallery
- Loss of sharpness in jpg imported as header in twentyeleven
- Getting alt text of featured image
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- How to resolve – IE 6 ignores img “width” properties
- WordPress is stripping the Alt tag’s quote marks from images where Alt is not set, but leaving the word ‘alt’ creating problems for ADA compliance
- WordPress reduces the full size image and uses it as the original
- Show taxonomy list with taxonomy images ( SOLVED)
- get the image of the post
- Is There A Way Of Using the_post_thumbnail() to Pull In A Specific Image From The Media Library
- Update image links in database
- ACF Image ID, echo the alt tag
- Change WordPress Media Manager
- How to stop images from being wrapped in tags?
- Output random (custom) image size
- WordPress crops images differently on retina screens?
- Upload media files to Amazon S3
- Out of memory error reporting
- How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?
- Remove the inline styling added in wp_get_attachment_image()
- Image not shown in the theme as it’s showing in HTML template [closed]
- Broken image links even though links are correct and images exist
- Broken Images until Page Refresh
- How to add an image to a custom url?
- Get image from parent category
- Images attached to posts from library link to 404 error page
- Images not displayed when moving site to local
- Caption and title in img alt tag are the same?
- fetch images and videos
- Facebook og:image issues after https change [closed]
- Specific image size is being generated without being registered
- How to use Facebox in WordPress theme?
- Mass crop images: Landscape images -> Portrait images
- How to display title of attached image in post?
- Getting thumbnail of uploaded image
- Display image for first sticky post only
- Get all image IDs from the Media Library
- Allow users to contribute images to a post
- Can’t add image to site via php
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Save Image in wp_options-Table
- Can I register a new thumbnail size and have it be an option in “Add Media”?
- Is it possible to get feature image url (full-size) from an image url of smaller size?
- How to make Custom Loop not crop featured images?
- Random home page background images with caption text
- How to add “alt” attribute for image during upload at WP front-end?
- Get Original Dimension Featured Image on the homepage
- WordPress keeps resizing my 947×947 image down to 500×500 (full-size option)
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- Featured Image Thumbnail size on Twenty Ten Archive Page
- How do I display the featured image from an image gallery using a reference in code? (example within)
- attach several images to post + gallery
- caption shortcode inserts blank paragraph
- How to change background slider image when hovering on text?
- Widget Style – Icon Type
- WordPress Problems
- Built-in image lazy loading: Does it come with a polyfill for older browsers?
- WordPress PHP custom function is causing 500 Internal Server Error Connection Timeout
- SQL: How to find all attachments that are not used in any posts/pages/custom_post_types
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- How to add element to the list of adjacent images?
- Responsive Images – Defining
- Text not wrapping properly around image in WordPress Visual Editor [closed]
- Why do images inserted in the post content via the_content() go off the max-width?
- WordPress Javascript displaying an image Question
- Broken images in media library
- Using a full-width hero image that can be changed in the dashboard by a user
- Resize External Image
- Fatal error: Allowed memory size in PHP when allocating less
- Resized images not working – 404
- Image thumbnail on single product issue | WooCommerce
- WordPress Is Saving Original Image Only
- Display images from JS?
- Anomaly with response coming from XML RPC Api get Post (integer out of range)
- Create a custom attachment thumbnail for quick page load
- Change the image for a certain URL
- How to make an image bigger with wp_get_image_editor
- Change image link in excerpt to point to post
- Putting the title attribute in image tag — Snapshot Theme from Woothemes
- Post migration – images do not display
- wp_handle_upload Image sizes
- Display Images from Array with wp_get_attachment_image() [closed]
- Orientation of featured image in post?
- Media Library shows default image instead of image preview
- Images have dissapeared from media library and site
- Uploading media to wordpress API with C# HttpClient
- How to add image alt attribute to the thumbnail code