Problems with Plugin Check
-
I am having very frustrating problems with verifying plugin code using the WordPress Plugin Check plugin. Below is some sample code –
if ( isset( $_POST[‘dmuk_toc_meta_nonce’] ) ) {
// Unsash the nonce value
$nonce_value = wp_unslash( $_POST[‘dmuk_toc_meta_nonce’] );// Now verify the nonce if ( ! wp_verify_nonce( $nonce_value, 'dmuk_toc_meta_nonce' ) ) { // Nonce verification failed, handle the error return; // Or handle appropriately }} else {
// Nonce not set, handle the error
return; // Or handle appropriately
}
This code triggers the warning –
Detected usage of a non-sanitized input variable: $_POST[‘xxxx_xxx_meta_nonce’]
I correct this and I get a warning about unslashing, I correct that and i get error about sanitising, I correct that and i get warning about unslashing – and so it continues. Correcting one error causes another error.
How should i format this code to fix all warnings
Note – the xxx is replacing my actual reference for security reasons
Any post and verify that involves a nonce gives an immense and never ending cycle of warnings!
I am lost for a solution to this continuous cycle of error – fix new error – fix – new error – fix – old error ! It is so frustratingThe page I need help with: [log in to see the link]
The topic ‘Problems with Plugin Check’ is closed to new replies.