acf_log_invalid_field_notice()ACF 1.0

Potentially log an error if a field doesn't exist when we expect it to.

Хуков нет.

Возвращает

null. Ничего (null).

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

acf_log_invalid_field_notice( $field, $function );
$field(массив) (обязательный)
An array representing the field that a value was requested for.
$function(строка) (обязательный)
The function that noticed the problem.

Код acf_log_invalid_field_notice() ACF 6.0.4

function acf_log_invalid_field_notice( $field, $function ) {
	// If "init" has fired, ACF probably wasn't initialized early.
	if ( did_action( 'init' ) ) {
		return;
	}

	$error_text = sprintf(
		__( '<strong>%1$s</strong> - We\'ve detected one or more calls to retrieve ACF field values before ACF has been initialized. This is not supported and can result in malformed or missing data. <a href="%2$s" target="_blank">Learn how to fix this</a>.', 'acf' ),
		acf_get_setting( 'name' ),
		acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/acf-field-functions/', 'docs', 'early_init_warning' )
	);
	_doing_it_wrong( $function, $error_text, '5.11.1' );
}