wp_prepare_attachment_for_js filter-hookWP 3.5.0

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 {@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 {@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_prepare_attachment_for_js()
wp_prepare_attachment_for_js
wp-includes/media.php 4552
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );

Where the hook is used in WordPress

Usage not found.