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 |
|---|---|
| 796 | |
| 797 | /** |
| 798 | * Fires after the header image is set or an error is returned. |
| 799 | * |
| 800 | * @since 2.1.0 |
| 801 | * |
| 802 | * @param string $file Path to the file. |
| 803 | * @param int $attachment_id Attachment ID. |
| 804 | */ |
| 805 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
| 806 | |
| 807 | return $this->finished(); |
| 808 | } elseif ( $width > $max_width ) { |
| 809 | $oitar = $width / $max_width; |
| 810 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
| 811 | if ( ! $image || is_wp_error( $image ) ) |
| 812 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 813 | |
| 814 | /** This filter is documented in wp-admin/custom-header.php */ |
| 815 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
| 816 | |
| 817 | $url = str_replace(basename($url), basename($image), $url); |
| 818 | $width = $width / $oitar; |
| 819 | $height = $height / $oitar; |
| 820 | } else { |
| 821 | $oitar = 1; |
| 822 | } |
| 823 | ?> |
| 824 | |
| Line | Code |
| 930 | elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
| 931 | $cropped = _copy_image_file( $attachment_id ); |
| 932 | else |
| 933 | $cropped = get_attached_file( $attachment_id ); |
| 934 | |
| 935 | if ( ! $cropped || is_wp_error( $cropped ) ) |
| 936 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 937 | |
| 938 | /** This filter is documented in wp-admin/custom-header.php */ |
| 939 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
| 940 | |
| 941 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
| 942 | |
| 943 | if ( ! empty( $_POST['create-new-attachment'] ) ) |
| 944 | unset( $object['ID'] ); |
| 945 | |
| 946 | // Update the attachment |
| 947 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
| 948 | |
| Line | Code |
| 1243 | (int) $dimensions['dst_width'], |
| 1244 | (int) $dimensions['dst_height'] |
| 1245 | ); |
| 1246 | |
| 1247 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
| 1248 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
| 1249 | } |
| 1250 | |
| 1251 | /** This filter is documented in wp-admin/custom-header.php */ |
| 1252 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
| 1253 | |
| 1254 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
| 1255 | |
| 1256 | unset( $object['ID'] ); |
| 1257 | |
| 1258 | $new_attachment_id = $this->insert_attachment( $object, $cropped ); |
| 1259 | |
| 1260 | $object['attachment_id'] = $new_attachment_id; |
| 1261 | $object['width'] = $dimensions['dst_width']; |