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 2 times in this file.
| Line | Code |
|---|---|
| 166 | if ( empty( $missing_sizes ) ) { |
| 167 | return $image_meta; |
| 168 | } |
| 169 | |
| 170 | // This also updates the image meta. |
| 171 | $image_meta = _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id ); |
| 172 | } |
| 173 | |
| 174 | /** This filter is documented in wp-admin/includes/image.php */ |
| 175 | $image_meta = apply_filters( 'wp_generate_attachment_metadata', $image_meta, $attachment_id, 'update' ); |
| 176 | |
| 177 | // Save the updated metadata. |
| 178 | wp_update_attachment_metadata( $attachment_id, $image_meta ); |
| 179 | |
| 180 | return $image_meta; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Updates the attached file and image meta data when the original image was edited. |
| Line | Code |
| 632 | * |
| 633 | * @since 2.1.0 |
| 634 | * @since 5.3.0 The `$context` parameter was added. |
| 635 | * |
| 636 | * @param array $metadata An array of attachment meta data. |
| 637 | * @param int $attachment_id Current attachment ID. |
| 638 | * @param string $context Additional context. Can be 'create' when metadata was initially created for new attachment |
| 639 | * or 'update' when the metadata was updated. |
| 640 | */ |
| 641 | return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id, 'create' ); |
| 642 | } |
| 643 | |
| 644 | /** |
| 645 | * Convert a fraction string to a decimal. |
| 646 | * |
| 647 | * @since 2.5.0 |
| 648 | * |
| 649 | * @param string $str |
| 650 | * @return int|float |