wp_ajax_cropped_attachment_id
Filter HookDescription
Filters the attachment ID for a cropped image.Hook Information
File Location |
wp-admin/includes/ajax-actions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4100 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$attachment_id
|
The attachment ID of the cropped image. |
string
|
$context
|
The Customizer control requesting the cropped image. |
Usage Examples
Basic Usage
<?php
// Hook into wp_ajax_cropped_attachment_id
add_filter('wp_ajax_cropped_attachment_id', 'my_custom_filter', 10, 2);
function my_custom_filter($attachment_id, $context) {
// Your custom filtering logic here
return $attachment_id;
}
Source Code Context
wp-admin/includes/ajax-actions.php:4100
- How this hook is used in WordPress core
<?php
4095 * @since 4.3.0
4096 *
4097 * @param int $attachment_id The attachment ID of the cropped image.
4098 * @param string $context The Customizer control requesting the cropped image.
4099 */
4100 $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context );
4101 }
4102
4103 wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) );
4104 }
4105
PHP Documentation
<?php
/**
* Filters the attachment ID for a cropped image.
*
* @since 4.3.0
*
* @param int $attachment_id The attachment ID of the cropped image.
* @param string $context The Customizer control requesting the cropped image.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-admin/includes/ajax-actions.php
Related Hooks
Related hooks will be displayed here in future updates.