wp_media_attach_action
Fires when media is attached or detached from a post.
Использование
add_action( 'wp_media_attach_action', 'wp_kama_media_attach_action', 10, 3 );
/**
* Function for `wp_media_attach_action` action-hook.
*
* @param string $action Attach/detach action. Accepts 'attach' or 'detach'.
* @param int $attachment_id The attachment ID.
* @param int $parent_id Attachment parent ID.
*
* @return void
*/
function wp_kama_media_attach_action( $action, $attachment_id, $parent_id ){
// action...
}
- $action(строка)
- Attach/detach action. Accepts 'attach' or 'detach'.
- $attachment_id(int)
- The attachment ID.
- $parent_id(int)
- Attachment parent ID.
Список изменений
| С версии 5.5.0 | Введена. |
Где вызывается хук
wp_media_attach_action
wp-admin/includes/media.php 3864
do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id );