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 |
---|---|
737 |
|
738 | /** |
739 | * Fires after the header image is set or an error is returned. |
740 | * |
741 | * @since 2.1.0 |
742 | * |
743 | * @param string $file Path to the file. |
744 | * @param int $attachment_id Attachment ID. |
745 | */ |
746 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
747 |
|
748 | return $this->finished(); |
749 | } elseif ( $width > $max_width ) { |
750 | $oitar = $width / $max_width; |
751 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
752 | if ( ! $image || is_wp_error( $image ) ) |
753 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
754 |
|
755 | /** This filter is documented in wp-admin/custom-header.php */ |
756 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
757 |
|
758 | $url = str_replace(basename($url), basename($image), $url); |
759 | $width = $width / $oitar; |
760 | $height = $height / $oitar; |
761 | } else { |
762 | $oitar = 1; |
763 | } |
764 | ?> |
765 |
|
Line | Code |
883 | elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
884 | $cropped = _copy_image_file( $attachment_id ); |
885 | else |
886 | $cropped = get_attached_file( $attachment_id ); |
887 |
|
888 | if ( ! $cropped || is_wp_error( $cropped ) ) |
889 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
890 |
|
891 | /** This filter is documented in wp-admin/custom-header.php */ |
892 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
893 |
|
894 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
895 |
|
896 | if ( ! empty( $_POST['create-new-attachment'] ) ) |
897 | unset( $object['ID'] ); |
898 |
|
899 | // Update the attachment |
900 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
901 |
|
Line | Code |
1197 | (int) $dimensions['dst_width'], |
1198 | (int) $dimensions['dst_height'] |
1199 | ); |
1200 |
|
1201 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1202 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1203 | } |
1204 |
|
1205 | /** This filter is documented in wp-admin/custom-header.php */ |
1206 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
1207 |
|
1208 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
1209 |
|
1210 | unset( $object['ID'] ); |
1211 |
|
1212 | $new_attachment_id = $this->insert_attachment( $object, $cropped ); |
1213 |
|
1214 | $object['attachment_id'] = $new_attachment_id; |
1215 | $object['url'] = wp_get_attachment_url( $new_attachment_id );; |