Greetings, We can edit image attributes with this get_image_tag filter when we are adding images or with regex and filter the_content,but is there any similar filter or action that can we use to edit these attributes when post is added or edited - updated,and not to write regex?

Here is the link I found.


Thanks in advance

  • Could you clarify what you want to do, and why you can't do it with get_image_tag?
    – Jan Fabry
    Oct 5, 2010 at 14:11
  • get_image_tag works when image is adding to post,I need to change attributes on fly,when post is updated,edited.Any similar action or filter that is fired when post is edited/updated?
    – user1147
    Oct 5, 2010 at 16:01

1 Answer 1


When post data is inserted into database it is passed through wp_insert_post_data filter in wp_insert_post() function (source).

According to documentation you can check for set ID argument to distinguish posts being updated from posts being created.

  • So where I can use wp_insert_post(). Can I use it in my theme metabox.php? or it should be in some particular place? Aug 5, 2012 at 4:45
  • @pixelngrain wherever you need to create new post in database?.. Please ask new question if you have specific situation and not sure how to use it.
    – Rarst
    Aug 5, 2012 at 12:26

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.