wp_prepare_attachment_for_js
Filter HookDescription
Filters the attachment data prepared for JavaScript.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4737 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$response
|
Array of prepared attachment data. See {@see wp_prepare_attachment_for_js()}. |
WP_Post
|
$attachment
|
Attachment object. |
array|false
|
$meta
|
Array of attachment meta data, or false if there is none. |
Usage Examples
Basic Usage
<?php
// Hook into wp_prepare_attachment_for_js
add_filter('wp_prepare_attachment_for_js', 'my_custom_filter', 10, 3);
function my_custom_filter($response, $attachment, $meta) {
// Your custom filtering logic here
return $response;
}
Source Code Context
wp-includes/media.php:4737
- How this hook is used in WordPress core
<?php
4732 *
4733 * @param array $response Array of prepared attachment data. See {@see wp_prepare_attachment_for_js()}.
4734 * @param WP_Post $attachment Attachment object.
4735 * @param array|false $meta Array of attachment meta data, or false if there is none.
4736 */
4737 return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
4738 }
4739
4740 /**
4741 * Enqueues all scripts, styles, settings, and templates necessary to use
4742 * all media JS APIs.
PHP Documentation
<?php
/**
* Filters the attachment data prepared for JavaScript.
*
* @since 3.5.0
*
* @param array $response Array of prepared attachment data. See {@see wp_prepare_attachment_for_js()}.
* @param WP_Post $attachment Attachment object.
* @param array|false $meta Array of attachment meta data, or false if there is none.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.