Action hook 'attachment_updated'

in WP Core File wp-includes/post.php at line 5023

View Source

attachment_updated

Action Hook
Description
Fires once an existing attachment has been updated.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Action
Line Number 5023

Hook Parameters

Type Name Description
int $post_id Post ID.
WP_Post $post_after Post object following the update.
WP_Post $post_before Post object before the update.

Usage Examples

Basic Usage
<?php
// Hook into attachment_updated
add_action('attachment_updated', 'my_custom_function', 10, 3);

function my_custom_function($post_id, $post_after, $post_before) {
    // Your custom code here
}

Source Code Context

wp-includes/post.php:5023 - How this hook is used in WordPress core
<?php
5018  			 *
5019  			 * @param int     $post_id      Post ID.
5020  			 * @param WP_Post $post_after   Post object following the update.
5021  			 * @param WP_Post $post_before  Post object before the update.
5022  			 */
5023  			do_action( 'attachment_updated', $post_id, $post_after, $post_before );
5024  		} else {
5025  
5026  			/**
5027  			 * Fires once an attachment has been added.
5028  			 *

PHP Documentation

<?php
/**
			 * Fires once an existing attachment has been updated.
			 *
			 * @since 4.4.0
			 *
			 * @param int     $post_id      Post ID.
			 * @param WP_Post $post_after   Post object following the update.
			 * @param WP_Post $post_before  Post object before the update.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.