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 4 times in this file.
Line | Code |
---|---|
706 |
|
707 | /** |
708 | * Fires after the header image is set or an error is returned. |
709 | * |
710 | * @since 2.1.0 |
711 | * |
712 | * @param string $file Path to the file. |
713 | * @param int $attachment_id Attachment ID. |
714 | */ |
715 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
716 |
|
717 | return $this->finished(); |
718 | } elseif ( $width > $max_width ) { |
719 | $oitar = $width / $max_width; |
720 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
721 | if ( ! $image || is_wp_error( $image ) ) |
722 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
723 |
|
724 | /** This filter is documented in wp-admin/custom-header.php */ |
725 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
726 |
|
727 | $url = str_replace(basename($url), basename($image), $url); |
728 | $width = $width / $oitar; |
729 | $height = $height / $oitar; |
730 | } else { |
731 | $oitar = 1; |
732 | } |
733 | ?> |
734 |
|
Line | Code |
840 | elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
841 | $cropped = _copy_image_file( $attachment_id ); |
842 | else |
843 | $cropped = get_attached_file( $attachment_id ); |
844 |
|
845 | if ( ! $cropped || is_wp_error( $cropped ) ) |
846 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
847 |
|
848 | /** This filter is documented in wp-admin/custom-header.php */ |
849 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
850 |
|
851 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
852 |
|
853 | if ( ! empty( $_POST['create-new-attachment'] ) ) |
854 | unset( $object['ID'] ); |
855 |
|
856 | // Update the attachment |
857 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
858 |
|
Line | Code |
1147 | (int) $crop_details['height'], |
1148 | (int) $dimensions['dst_width'], |
1149 | (int) $dimensions['dst_height'] |
1150 | ); |
1151 |
|
1152 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1153 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1154 | } |
1155 |
|
1156 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
1157 |
|
1158 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
1159 |
|
1160 | unset( $object['ID'] ); |
1161 |
|
1162 | $new_attachment_id = $this->insert_attachment( $object, $cropped ); |
1163 |
|
1164 | $object['attachment_id'] = $new_attachment_id; |
1165 | $object['width'] = $dimensions['dst_width']; |