• I’m trying to use check_admin_referer(). I’ve followed the example in the codex and I believe I have everything set up correctly but I get a 403.

    Here’s the bare bones:

    class StupidClass {
    ...
    public function render_page(){
    ?>
    <form action="" id="stupid_form" method="post">
    <?php wp_nonce_field('hello', 'token'); ?>
    <input type="submit" value="hit me">
    </form>
    <?php
    }

    public function hello(){
    check_admin_referer('hello', 'token');
    wp_die();
    }
    }

    It works if I use check_admin_referer() without arguments but that is no longer recommended. Is there anything obvious that I’ve missed?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Where does your form appear? It has to be on an admin page such as one added with add_menu_page().

Viewing 1 replies (of 1 total)

The topic ‘Why am I getting a 403 from check_admin_referer()?’ is closed to new replies.