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.

No Hooks.

Returns

Mixed.

Usage

acf_reset_media_enqueue_after_rest( $response );
$response(WP_REST_Response|WP_HTTP_Response|WP_Error|mixed) (required)
The WordPress response object.

Changelog

Since 6.0 Introduced.

acf_reset_media_enqueue_after_rest() code ACF 6.8.8

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;
}