Form Submitting Error with get_template_part()

I know you say it’s not a nonce issue, but it clearly is. That notice is the default ‘This nonce didn’t check out’ message. I don’t know exactly why the nonce is failing, but that is what is happening.

I would double check how your nonces are created and checked. If you’re using wp_nonce_field() make sure both action values and argument values are the same. Also, double check spelling of variables, or any scope-related issues that could be causing the nonce to fail.

EDIT

Following up on your insistence that it’s not a nonce issue (which it is. The nonce issue is caused by a scope issue), here’s what’s probably happened. Included/required files are executed in the scope in which they’re included. My guess is you’re using a variable to build either the nonce action or the nonce name. Because get_template_part() includes the template file in the scope of that function, it’s no longer being executed in the scope of your admin page’s display callback. You either need to globalize those variables in all locations, or you need to use constants instead of variables.

Leave a Comment