woocommerce_rest_prepare_themes хук-фильтрWC 1.0

Filter the list returned from the API.

Использование

add_filter( 'woocommerce_rest_prepare_themes', 'wp_kama_woocommerce_rest_prepare_themes_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_themes` filter-hook.
 * 
 * @param WP_REST_Response $response The response object.
 * @param array            $item     The original item.
 * @param WP_REST_Request  $request  Request used to generate the response.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_themes_filter( $response, $item, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$item(массив)
The original item.
$request(WP_REST_Request)
Request used to generate the response.

Где вызывается хук

Themes::prepare_item_for_response()
woocommerce_rest_prepare_themes
woocommerce/src/Admin/API/Themes.php 150
return apply_filters( 'woocommerce_rest_prepare_themes', $response, $item, $request );

Где используется хук в WooCommerce

woocommerce/src/Internal/Admin/Onboarding/OnboardingThemes.php 33
add_filter( 'woocommerce_rest_prepare_themes', array( __CLASS__, 'add_uploaded_theme_data' ) );