• Resolved warpy

    (@warpy)


    Hi, A little while ago I made a small custom form.
    however the nonce field that I added won’t work and I can’t find out why.

    The nonce field looks like this one: wp_nonce_field(‘edit’, ‘wp-check’)

    The form is getting checked by a file which I included and in that file I added the verify which looks like this: wp_verify_nonce($_POST[‘wp-check’], ‘edit’ );
    this check I added to an if check. However I keep getting the message that the nonce isn’t verified. It looks like its not reaching the if check. Though when I echo something normal in the file I can see it on the page which means that the file has been included correctly.

    Included file:

    if(isset($_POST['name3'])){
      if(wp_verify_nonce($_POST['wp-check'], 'edit' )){
        echo '1';
      }else{
        echo '0';
      }
    }

    Form

    <form method="post" id="acc-edit">
    <input type="file" name="name">
    <input type="file" name="name2">
    <input type="file" name="name3">
    wp_nonce_field('edit', 'wp-check');
    </form>

    It might be I am missing something small but I have no idea what and I am curious if anyone could help me with this.

    thanx

  • The topic ‘Nonce field ain't working’ is closed to new replies.