acf_reset_media_enqueue_after_rest()ACF 6.0

Reset wp_enqueue_media action count after REST call so it can happen inside the main execution if required.

Хуков нет.




acf_reset_media_enqueue_after_rest( $response );
$response(WP_REST_Response|WP_HTTP_Response|WP_Error|разное) (обязательный)
The WordPress response object.

Список изменений

С версии 6.0 Введена.

Код acf_reset_media_enqueue_after_rest() ACF 6.0.4

function acf_reset_media_enqueue_after_rest( $response ) {
	acf_set_data( 'acf_inside_rest_call', false );
	if ( acf_get_data( 'acf_should_reset_media_enqueue' ) && acf_get_data( 'acf_did_render_block_form' ) ) {
		global $wp_actions;
		//phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- no other option here as this works around a breaking WordPress change with REST preload scopes.
		$wp_actions['wp_enqueue_media'] = 0;

	return $response;