Verify Nonce returns false – Request Nonce returns correct value

I’m trying to verify that the nonce I created exists but for some reason it keeps returning false, why is this happening?

Creating my nonce:

Read More
<?php wp_nonce_field('test_slider_action','test_slider_options_nonce'); ?>

Verifying my nonce exists:

if($_POST && wp_verify_nonce($_REQUEST['test_slider_options_nonce']))
    echo "TEST";

if I dump my $_REQUEST I get the correct value, but if I dump my wp_verify_nonce it returns false. If it matters, both my $_POST check and form / nonce creation is on the same page. What else do I need to get it to verify?

Related posts

1 comment

  1. You need to pass the action to check your nonce against, wp_verify_nonce has two parameters.

    if($_POST && wp_verify_nonce($_REQUEST['test_slider_options_nonce'],'test_slider_action'))
        echo "TEST";
    

Comments are closed.