Home › Forums › Backend Issues (wp-admin) › Validate_value fails with get_field_object is used › Reply To: Validate_value fails with get_field_object is used
The reason that you’re getting the validation error page is that the validation is causing a PHP error during the AJAX validation request and making the AJAX fail.
Your error is here
$startDateObj = get_field_object('start_date', false, false, false);
Since the field has never been saved, get_field_object() using the field name fails and returns false. You must use the field key. Since the value of $startDateObj is false this line is causing a PHP error
$key = $startDateObj['key'] ?? null;
Because ‘key’ is an undefined index, in a value that is not an array.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!