Support

Account

Home Forums General Issues Validate an id before saving, for avoid duplicatication

Helping

Validate an id before saving, for avoid duplicatication

  • hello, if you can help me.
    I tested all the initial part of the registration, field validations in front end, however ..
    for the item Product ID,
    cannot be duplicated.

    I need to validate the same before saving to the db.
    Can you help me?
    code below …
    –/–
    function salvar_formulario($post_id){

    if($post_id != ‘cadastro_item’){
    return $post_id;
    }
    $identificaitem = $_POST[‘acf’][‘field_58779b4’];
    $item = $_POST[‘acf’][‘field_5fa30fd2’];
    $quantidade = $_POST[‘acf’][‘field_5fac22’];
    $seunome = $_POST[‘acf’][‘field_5f4ed30’];

    $post = array(
    ‘post_status’ => ‘publish’,
    ‘post_title’ => $item,
    ‘post_type’ => ‘cadastro_item’
    );

    $id = wp_insert_post($post);

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.