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;
}