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 |
---|---|
822 |
|
823 | /** |
824 | * Fires after the header image is set or an error is returned. |
825 | * |
826 | * @since 2.1.0 |
827 | * |
828 | * @param string $file Path to the file. |
829 | * @param int $attachment_id Attachment ID. |
830 | */ |
831 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
832 |
|
833 | return $this->finished(); |
834 | } elseif ( $width > $max_width ) { |
835 | $oitar = $width / $max_width; |
836 | $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) ); |
837 | if ( ! $image || is_wp_error( $image ) ) { |
838 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
839 | } |
840 |
|
841 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
842 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
843 |
|
844 | $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); |
845 | $width = $width / $oitar; |
846 | $height = $height / $oitar; |
847 | } else { |
848 | $oitar = 1; |
849 | } |
850 | ?> |
851 |
|
Line | Code |
976 | } else { |
977 | $cropped = get_attached_file( $attachment_id ); |
978 | } |
979 |
|
980 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
981 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
982 | } |
983 |
|
984 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
985 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
986 |
|
987 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
988 |
|
989 | if ( ! empty( $_POST['create-new-attachment'] ) ) { |
990 | unset( $object['ID'] ); |
991 | } |
992 |
|
993 | // Update the attachment |
994 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
Line | Code |
1312 | (int) $dimensions['dst_width'], |
1313 | (int) $dimensions['dst_height'] |
1314 | ); |
1315 |
|
1316 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1317 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1318 | } |
1319 |
|
1320 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
1321 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
1322 |
|
1323 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
1324 |
|
1325 | $previous = $this->get_previous_crop( $object ); |
1326 |
|
1327 | if ( $previous ) { |
1328 | $object['ID'] = $previous; |
1329 | } else { |
1330 | unset( $object['ID'] ); |