Home › Forums › Front-end Issues › Unique value field › Reply To: Unique value field
Hi Howdy_McGee, thanks a lot for your reply.
At some point I figured it out that the problem was the missing id for new post.
So I did the following:
(probably not the best idea, but…)
(...)
if (isset($_POST['post_ID'])) {
//just like it was at first
$post_id = intval($_POST['post_ID']);
} elseif (isset($_POST['post_id'])) {
//just like it was at first
$post_id = intval($_POST['post_id']);
} elseif (isset($_REQUEST['item_id'])) {
// BECAUSE MY FORM COULD BE EDITING INSTEAD OF INCLUDING
$post_id = intval($_REQUEST['item_id']);
} else {
// I INVENTED AN ID FOR THIS NEW POST
$post_id = intval('9999999999999999');
}
//And since I couldnt check the post-type for a new post,
//I specified the post-type here (cause in my case this function only applies to this form)
$post_type = 'pt_publicacoes_doi';
$field_name = $field['name'];
(...)
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.