wp_verify_nonceが機能しないのは驚きです。それは未定義の関数エラーを表示しています、私のWordPressのバージョンは現在までです。私はプラグインのコードをつけています。問題はwp_verify_nonce()
がpluggable関数であることである私にwp_verify_nonceは動作しませんが、wp_create_nonceは動作します
add_shortcode('tw_safety_checklist_template','init_tw_safety_checklist');
function init_tw_safety_checklist(){
echo '<form method="post">
<label>Name</label>
<input type="hidden" name="tw_new_checklist_nonce" value="'.wp_create_nonce('tw_new_checklist_nonce').'"/>
<input type="text" name="tw_name" />
<input type="submit" name="submit" value="Submit"/>
</form>';
}
if(isset($_POST['tw_new_checklist_nonce'])){
tw_create_my_template();
}
function tw_create_my_template(){
if(wp_verify_nonce($_POST['tw_new_checklist_nonce'],'tw-new-checklist-nonce'))
{
return 'Worked!';
}
}
こんにちは、お返事ありがとうございます!それは完全に働いた – user3783411