wp_prepare_attachment_for_js
Filters the attachment data prepared for JavaScript.
Использование
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 {@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 of prepared attachment data. See {@see wp_prepare_attachment_for_js()}.
- $attachment(WP_Post)
- Attachment object.
- $meta(массив|false)
- Array of attachment meta data, or false if there is none.
Список изменений
С версии 3.5.0 | Введена. |
Где вызывается хук
wp-includes/media.php 4559
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );