Fixing undefined key array error from wp_verify_nonce in WP-CLI
-
I was using WP_CLI to update a bunch of posts unrelated to my site’s podcast when I continuously received this warning:
Warning: Undefined array key "wsl-sab-nonce" in /srv/htdocs/wp-content/plugins/smart-app-banner/wsl-smart-app-banner.php on line 544It came from line
544inwsl-smart-app-banner.php:if ( ! wp_verify_nonce( $_POST['wsl-sab-nonce'], plugin_basename( __FILE__ ) ) ) {I changed it to this, and the error went away:
if ( ! isset( $_POST['wsl-sab-nonce'] ) || ! wp_verify_nonce( $_POST['wsl-sab-nonce'], plugin_basename( __FILE__ ) ) ) {
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.