acf_log_invalid_field_notice()
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 log invalid field notice ACF 6.4.2
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(
// This happens too early for translations to be loaded properly.
'<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_get_setting( 'name' ),
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/acf-field-functions/', 'docs', 'early_init_warning' )
);
_doing_it_wrong( esc_html( $function ), acf_esc_html( $error_text ), '5.11.1' );
}