Created
March 28, 2020 16:51
-
-
Save webhasan/79768ccd6e3708483f7f53ae5ab5dc1e to your computer and use it in GitHub Desktop.
Nonce validation fix for logged out user with WooCommerce setuped
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Plugin { | |
public function hook() { | |
add_filter('nonce_user_logged_out', array($this, 'nonce_fix'), 100, 2); | |
} | |
public function nonce_fix($uid = 0, $action = ''){ | |
$nonce_actions = array('pgfy-ajax-modal','pgfy-add-to-cart'); | |
if(in_array($action, $nonce_actions)) { | |
return 0; | |
} | |
return $uid; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment