Support

Account

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'];
    
    (...)