WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
Could you clarify what you want to do, and why you can't do it with get_image_tag? – Jan Fabry Oct 5 '10 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 '10 at 16:01

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.

share|improve this answer
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? – pixelngrain Aug 5 '12 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 '12 at 12:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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