How can I best make WP link to the large version of the image in all posts (instead of the original one) without modifying all the data in the database? I'm probably looking for the best filter to attach to.
You can modify the content that is displayed on the site by hooking in to the
the_content filter. However, this is where the hard work starts. You need to identify all the images, figure out the links to the large sizes, and replace them. This could be a costly operation, so you might want to save the post back to the database and set a (hidden) meta key to indicate you don't have to do it again next time.
Now, some hints on how to do this: to get info on the attached images, you use
get_children() and specify you only want attachments:
get_children($post->ID, array('post_type' => 'attachment')). Attachments are stored like posts, and you can request different sizes with
wp_get_attachment_image_src() by passing the requested size (
All you have to do is to go into the HTML version of your post and add a little simple code - don't panic if you think you don't understand code.
<a href="https://bdaiken.files.wordpress.com/2016/01/wp-header.jpg" rel="attachment wp-att-99"> <img class="alignnone wp-image-99" src="https://bdaiken.files.wordpress.com/2016/01/wp-header.jpg? w=300" alt="snow farm" width="696" height="290" /> </a>
The middle bit of this is what already exists for your image. The bit above and the at the end is what you add. The source for image (in this case src="https://bdaiken.files.wordpress.com/2016/01/wp-header.jpg' has to be pasted in from the middle html into the new html - don't copy the '?'.