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 |
---|---|
870 |
|
871 | /** |
872 | * Fires after the header image is set or an error is returned. |
873 | * |
874 | * @since 2.1.0 |
875 | * |
876 | * @param string $file Path to the file. |
877 | * @param int $attachment_id Attachment ID. |
878 | */ |
879 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication. |
880 |
|
881 | return $this->finished(); |
882 | } elseif ( $width > $max_width ) { |
883 | $oitar = $width / $max_width; |
884 |
|
885 | $image = wp_crop_image( |
886 | $attachment_id, |
887 | 0, |
888 | 0, |
Line | Code |
893 | false, |
894 | str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) |
895 | ); |
896 |
|
897 | if ( ! $image || is_wp_error( $image ) ) { |
898 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
899 | } |
900 |
|
901 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
902 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication. |
903 |
|
904 | $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); |
905 | $width = $width / $oitar; |
906 | $height = $height / $oitar; |
907 | } else { |
908 | $oitar = 1; |
909 | } |
910 | ?> |
911 |
|
Line | Code |
1052 | } else { |
1053 | $cropped = get_attached_file( $attachment_id ); |
1054 | } |
1055 |
|
1056 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1057 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
1058 | } |
1059 |
|
1060 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
1061 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
1062 |
|
1063 | $attachment = $this->create_attachment_object( $cropped, $attachment_id ); |
1064 |
|
1065 | if ( ! empty( $_POST['create-new-attachment'] ) ) { |
1066 | unset( $attachment['ID'] ); |
1067 | } |
1068 |
|
1069 | // Update the attachment. |
1070 | $attachment_id = $this->insert_attachment( $attachment, $cropped ); |
Line | Code |
1395 | (int) $dimensions['dst_width'], |
1396 | (int) $dimensions['dst_height'] |
1397 | ); |
1398 |
|
1399 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1400 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1401 | } |
1402 |
|
1403 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
1404 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
1405 |
|
1406 | $attachment = $this->create_attachment_object( $cropped, $attachment_id ); |
1407 |
|
1408 | $previous = $this->get_previous_crop( $attachment ); |
1409 |
|
1410 | if ( $previous ) { |
1411 | $attachment['ID'] = $previous; |
1412 | } else { |
1413 | unset( $attachment['ID'] ); |