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 |
|---|---|
| 3857 | // Delete the temporary cropped file, we don't need it. |
| 3858 | wp_delete_file( $cropped ); |
| 3859 | |
| 3860 | // Additional sizes in wp_prepare_attachment_for_js(). |
| 3861 | add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); |
| 3862 | break; |
| 3863 | } |
| 3864 | |
| 3865 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
| 3866 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
| 3867 | $object = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); |
| 3868 | unset( $object['ID'] ); |
| 3869 | |
| 3870 | // Update the attachment. |
| 3871 | add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); |
| 3872 | $attachment_id = $wp_site_icon->insert_attachment( $object, $cropped ); |
| 3873 | remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); |
| 3874 | |
| 3875 | // Additional sizes in wp_prepare_attachment_for_js(). |
| Line | Code |
| 3885 | * @since 4.3.0 |
| 3886 | * |
| 3887 | * @param string $context The Customizer control requesting the cropped image. |
| 3888 | * @param int $attachment_id The attachment ID of the original image. |
| 3889 | * @param string $cropped Path to the cropped image file. |
| 3890 | */ |
| 3891 | do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); |
| 3892 | |
| 3893 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
| 3894 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
| 3895 | |
| 3896 | $parent_url = wp_get_attachment_url( $attachment_id ); |
| 3897 | $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); |
| 3898 | |
| 3899 | $size = @getimagesize( $cropped ); |
| 3900 | $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; |
| 3901 | |
| 3902 | $object = array( |
| 3903 | 'post_title' => wp_basename( $cropped ), |