WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 4024 | // Delete the temporary cropped file, we don't need it. |
| 4025 | wp_delete_file( $cropped ); |
| 4026 | |
| 4027 | // Additional sizes in wp_prepare_attachment_for_js(). |
| 4028 | add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); |
| 4029 | break; |
| 4030 | } |
| 4031 | |
| 4032 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
| 4033 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
| 4034 | $attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); |
| 4035 | unset( $attachment['ID'] ); |
| 4036 | |
| 4037 | // Update the attachment. |
| 4038 | add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); |
| 4039 | $attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped ); |
| 4040 | remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); |
| 4041 | |
| 4042 | // Additional sizes in wp_prepare_attachment_for_js(). |
| Line | Code |
| 4052 | * @since 4.3.0 |
| 4053 | * |
| 4054 | * @param string $context The Customizer control requesting the cropped image. |
| 4055 | * @param int $attachment_id The attachment ID of the original image. |
| 4056 | * @param string $cropped Path to the cropped image file. |
| 4057 | */ |
| 4058 | do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); |
| 4059 | |
| 4060 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
| 4061 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
| 4062 | |
| 4063 | $parent_url = wp_get_attachment_url( $attachment_id ); |
| 4064 | $parent_basename = wp_basename( $parent_url ); |
| 4065 | $url = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url ); |
| 4066 | |
| 4067 | $size = wp_getimagesize( $cropped ); |
| 4068 | $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; |
| 4069 | |
| 4070 | // Get the original image's post to pre-populate the cropped image. |