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 |
---|---|
726 |
|
727 | /** |
728 | * Fires after the header image is set or an error is returned. |
729 | * |
730 | * @since 2.1.0 |
731 | * |
732 | * @param string $file Path to the file. |
733 | * @param int $attachment_id Attachment ID. |
734 | */ |
735 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
736 |
|
737 | return $this->finished(); |
738 | } elseif ( $width > $max_width ) { |
739 | $oitar = $width / $max_width; |
740 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
741 | if ( ! $image || is_wp_error( $image ) ) |
742 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
743 |
|
744 | /** This filter is documented in wp-admin/custom-header.php */ |
745 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
746 |
|
747 | $url = str_replace(basename($url), basename($image), $url); |
748 | $width = $width / $oitar; |
749 | $height = $height / $oitar; |
750 | } else { |
751 | $oitar = 1; |
752 | } |
753 | ?> |
754 |
|
Line | Code |
860 | elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
861 | $cropped = _copy_image_file( $attachment_id ); |
862 | else |
863 | $cropped = get_attached_file( $attachment_id ); |
864 |
|
865 | if ( ! $cropped || is_wp_error( $cropped ) ) |
866 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
867 |
|
868 | /** This filter is documented in wp-admin/custom-header.php */ |
869 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
870 |
|
871 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
872 |
|
873 | if ( ! empty( $_POST['create-new-attachment'] ) ) |
874 | unset( $object['ID'] ); |
875 |
|
876 | // Update the attachment |
877 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
878 |
|
Line | Code |
1165 | (int) $dimensions['dst_width'], |
1166 | (int) $dimensions['dst_height'] |
1167 | ); |
1168 |
|
1169 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1170 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1171 | } |
1172 |
|
1173 | /** This filter is documented in wp-admin/custom-header.php */ |
1174 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
1175 |
|
1176 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
1177 |
|
1178 | unset( $object['ID'] ); |
1179 |
|
1180 | $new_attachment_id = $this->insert_attachment( $object, $cropped ); |
1181 |
|
1182 | $object['attachment_id'] = $new_attachment_id; |
1183 | $object['width'] = $dimensions['dst_width']; |