I can't find a specific hook. If I already have added an image to an article via editor and then I edit it, I'd like to intercept the code just before it is sent again to the editor.

I already use 'image_send_to_editor' but it works on the first image insertion, not if the image gets edited.

Can you help me please?

  • Did you find such filter? Looking for it too. – Sergey Apr 2 '16 at 13:47
  • mmm to be true, I didn't remember :P 4 years are too much for me :) But I think the answers below can be interesting too. – Luca Reghellin Apr 3 '16 at 16:04

edit_attachment Runs when an attached file is edited/updated to the database. Action function arguments: attachment ID

This is found deocumented in the Codex under the Action Reference. Please take a closer look at the Codex before posting questions related directly to syntax. :)

  • Well, it doesn't work at all. – Luca Reghellin Aug 31 '12 at 16:50
  • Great description. – Eric Holmes Aug 31 '12 at 17:07

You'll also be surprised to find that the straightforward answer of using the_content will work, too.

For instance, I wrote an answer to a question on this site that asked how to add a class to the anchor tag on linked images. In some cases, such as when the image is edited after being added, solutions that use image_send_to_editor won't work. You might want to check it out: https://wordpress.stackexchange.com/a/189881/67366

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.