{"id":10085373,"date":"2018-03-17T13:04:45","date_gmt":"2018-03-17T13:04:45","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/why-am-i-getting-a-403-from-check_admin_referer\/"},"modified":"2018-03-17T13:04:45","modified_gmt":"2018-03-17T13:04:45","slug":"why-am-i-getting-a-403-from-check_admin_referer","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/why-am-i-getting-a-403-from-check_admin_referer\/","title":{"rendered":"Why am I getting a 403 from check_admin_referer()?"},"content":{"rendered":"<p>I&#8217;m trying to use <code>check_admin_referer()<\/code>. I&#8217;ve followed the <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/check_admin_referer\">example in the codex<\/a> and I believe I have everything set up correctly but I get a 403.<\/p>\n<p>Here&#8217;s the bare bones:<br \/>\n<code><br \/>\nclass StupidClass {<br \/>\n...<br \/>\n\tpublic function render_page(){<br \/>\n\t\t?&gt;<br \/>\n\t\t\t&lt;form action=\"\" id=\"stupid_form\" method=\"post\"&gt;<br \/>\n\t\t\t\t&lt;?php wp_nonce_field('hello', 'token'); ?&gt;<br \/>\n\t\t\t\t&lt;input type=\"submit\" value=\"hit me\"&gt;<br \/>\n\t\t\t&lt;\/form&gt;<br \/>\n\t\t&lt;?php<br \/>\n\t}<\/p>\n<p>\tpublic function hello(){<br \/>\n\t\tcheck_admin_referer('hello', 'token');<br \/>\n\t\twp_die();<br \/>\n\t}<br \/>\n}<br \/>\n<\/code><\/p>\n<p>It works if I use <code>check_admin_referer()<\/code> without arguments but that is no longer recommended. Is there anything obvious that I&#8217;ve missed?<\/p>\n","protected":false},"template":"","class_list":["post-10085373","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10085373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10085373\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10085373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}