attachment_updated

Fires once an existing attachment has been updated.

Description

do_action( 'attachment_updated', (int) $post_id, (WP_Post) $post_after, (WP_Post) $post_before ); 

Parameters (3)

0. $post_id (int)
The post id.
1. $post_after (WP_Post)
Post object following the update.
2. $post_before (WP_Post)
Post object before the update.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'attachment_updated', $post_id, $post_after, $post_before ); 
The following example is for adding a hook callback.
  1. // define the attachment_updated callback 
  2. function action_attachment_updated( $post_id, $post_after, $post_before ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'attachment_updated', 'action_attachment_updated', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'attachment_updated', 'action_attachment_updated', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/post.php  
  1. do_action( 'attachment_updated', $post_ID, $post_after, $post_before );