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
There is no PHP errors and wp_debug is enabled. If I run this:
<?php
$startDateObj = get_field_object('start_date', false, false, false);
echo 'Obj<br>';
var_dump($startDateObj);
$key = $startDateObj['key'] ?? null;
echo 'Key<br>';
var_dump($key);
$startDate = $_POST['acf'][$key] ?? null;
echo 'StartDate<br>';
var_dump($_POST['acf'][$key]);
exit;
Results in this:
Obj
array(22) {
[“ID”]=>
int(0)
[“key”]=>
string(19) “field_5a44cac20461f”
[“label”]=>
string(10) “Start date”
[“name”]=>
string(10) “start_date”
[“prefix”]=>
string(3) “acf”
[“type”]=>
string(16) “date_time_picker”
[“value”]=>
NULL
[“menu_order”]=>
int(1)
[“instructions”]=>
string(0) “”
[“required”]=>
int(1)
[“id”]=>
string(0) “”
[“class”]=>
string(0) “”
[“conditional_logic”]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(3) {
[“field”]=>
string(19) “field_5b33474da2033”
[“operator”]=>
string(2) “==”
[“value”]=>
string(5) “theme”
}
}
}
[“parent”]=>
string(19) “group_5a44bc8cad892”
[“wrapper”]=>
array(3) {
[“width”]=>
string(2) “50”
[“class”]=>
string(0) “”
[“id”]=>
string(0) “”
}
[“_name”]=>
string(10) “start_date”
[“_prepare”]=>
int(0)
[“_valid”]=>
int(1)
[“admin_only”]=>
int(0)
[“display_format”]=>
string(12) “F j, Y H:i:s”
[“return_format”]=>
string(11) “Y-m-d H:i:s”
[“first_day”]=>
int(1)
}Key
string(19) “field_5a44cac20461f”StartDate
string(19) “2018-10-09 00:00:00”
I’m updating an existing post.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.