wp_prepare_attachment_for_js
Filters the attachment data prepared for JavaScript.
Usage
add_filter( 'wp_prepare_attachment_for_js', 'wp_kama_prepare_attachment_for_js_filter', 10, 3 ); /** * Function for `wp_prepare_attachment_for_js` filter-hook. * * @param array $response Array of prepared attachment data. @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. * * @return array */ function wp_kama_prepare_attachment_for_js_filter( $response, $attachment, $meta ){ // filter... return $response; }
- $response(array)
- Array of prepared attachment data. @see wp_prepare_attachment_for_js().
- $attachment(WP_Post)
- Attachment object.
- $meta(array|false)
- Array of attachment meta data, or false if there is none.
Changelog
Since 3.5.0 | Introduced. |
Where the hook is called
wp-includes/media.php 4508
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );