Action hook 'edit_attachment'

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

View Source

edit_attachment

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 5010

Hook Parameters

Type Name Description
int $post_id Attachment ID.

Usage Examples

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

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

Source Code Context

wp-includes/post.php:5010 - How this hook is used in WordPress core
<?php
5005  			 *
5006  			 * @since 2.0.0
5007  			 *
5008  			 * @param int $post_id Attachment ID.
5009  			 */
5010  			do_action( 'edit_attachment', $post_id );
5011  
5012  			$post_after = get_post( $post_id );
5013  
5014  			/**
5015  			 * Fires once an existing attachment has been updated.

PHP Documentation

<?php
/**
			 * Fires once an existing attachment has been updated.
			 *
			 * @since 2.0.0
			 *
			 * @param int $post_id Attachment ID.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.