nonce in custom form is not verifying


I have a shortcode which calls an html form:

function add_signup_form () {
    require_once ( "apps/registration_form.php");
    return signup_form();
add_shortcode( 'add_signup_form', 'add_signup_form' );

The form loads on the WordPress page just fine. But when the form is submitted the nonce is not validating.

function signup_form() {     
    $form = '<form action="'.plugins_url().'/sunday-signup/apps/save_registration.php" method="post" id="setting">
                 ' . wp_nonce_field( "register","registration_nonce" ). '  
    <input type="submit" name="submit_registration" value="Save Reservation" class="button">
    return $form;

in the processing .php I’m able to print_r($_POST) and see the value of the nonce and other fields, but my condition won’t satisfy.:

if ( isset($_POST['submit_registration']) ) {

    if ( wp_verify_nonce( $_POST['registration_nonce'], 'register' ) ) {

I’ve done this many times, but never using a shortcode. Is that the issue?

breadwild 1 year 2020-07-15T22:10:58-05:00 0 Answers 42 views 0

Leave an answer