0

I've taken over maintenance of a Wordpress website. My predecessor made a custom "image_send_to_editor" function to add images to posts. All images added this way are "full" size and are not responsive (no srcset).

I need some way to fix this. All images should be "large" size and have the srcset attribute.

I already removed the custom "image_send_to_editor" function, so new images are OK.

Code the image_send_to_editor function spits out:

<a class="lightBox" href="https://mydomain/image-1-1.jpg"     rel="attachment op-att-5784" data-relation="group">
<img class="op-att-5784" src="https://mydomain/image-1-1.jpg" alt="image alt text" width="1280" height="720" data-headline="" data-description="" />
</a>

image_send_to_editor just creates the html code for an image, which is then added to a post, the post is then stored in the database.

  • 1
    Hi. Can you please specify how these images are rendered? Are they hardcoded and stored in database? What did the function do? Save the images to DB or just render them in front-end lively? – Jack Johansson Apr 4 '17 at 18:06
  • Hardcoded and stored into the database (post content). image_send_to_editor just creates the html code for an image, which is then added to a post, the post is then stored in the database. – projectIncomplete Apr 5 '17 at 5:52
0

Because the old image_send_to_editor function did NOT include the wp-image-xxxxx class with the image ID, we have to make database queries to find the correct ID for a given image.

Making database queries for every image does not seem like a good idea.

The only real solution is to manually delete and re-add the images to the posts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.