Verify Wordpress nonce in a Add Custom Post Type form

时间:2019-04-17 00:59:00

标签: wordpress nonce wordpress-plugin-creation

I've created a Custom Post Type (CPT) and I've added a field group using Advanced Custom Fields (ACF) to WordPress. On the Add CPT screen, there is a hidden "_wpnonce" field in the form and I'm trying to verify that and manipulate some $_POST data. Is it possible to do?

I've tried to use wp_verify_nonce( $_REQUEST['_wpnonce'], 'editpost' );, which fails. I've also tried passing 'post.php' as the action, and leaving the action arg off. And I've tried using $_POST data instead of $_REQUEST.

I'm not sure if I'm able to verify that nonce, or if I'm supposed to somehow insert my own nonce into the Add.. page to verify against.

0 个答案:

没有答案