{"id":15857431,"date":"2022-07-25T17:49:29","date_gmt":"2022-07-25T17:49:29","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/error-validating-wordpress-nonce\/"},"modified":"2022-07-25T17:56:29","modified_gmt":"2022-07-25T17:56:29","slug":"error-validating-wordpress-nonce","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/error-validating-wordpress-nonce\/","title":{"rendered":"Error validating WordPress nonce"},"content":{"rendered":"<p>Hi, today I start to receive a <strong>Failed security check<\/strong> message in several pages, but not in all browsers.<\/p>\n<p>I checked the code and I see that in the file <em>productprint.php<\/em> method <em>productprint_button<\/em> at line 462, the url is created with <em>wp_nonce_url<\/em> that could to have problems with the char &amp; present on <em>$link<\/em> var.<\/p>\n<p>I changed that line and now all is working fine.<\/p>\n<p>I&#8217;ll copy here the previous code commented and the new code:<\/p>\n<pre><code>$link = home_url(&#039;\/index.php?task=productprint&amp;pid=&#039;.$product-&gt;get_id()); \/\/sets the URL for the post page\n\/\/$nonced_url = wp_nonce_url($link, $product-&gt;get_id()); \/\/ adds a nonce to the URL\n$nonced_url = $link . &#039;&amp;_wpnonce=&#039; . wp_create_nonce( $product-&gt;get_id() ); \/\/ Carlos Longarela, 2022\/07\/25. Fix the problem with bad nonce in print page.<\/code><\/pre>\n<p>Kindly regards.<\/p>\n","protected":false},"template":"","class_list":["post-15857431","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15857431","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":3,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15857431\/revisions"}],"predecessor-version":[{"id":15857462,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15857431\/revisions\/15857462"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15857431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}