New answers tagged

2

Now I got it! WordPress is just awesome. Also Thank you knif3r, your suggestions help me lot. I am trying to explain it in my words. Please correct me, if I am wrong. What is nonce? Nonce is something like security hash to prevent attacks and mistakes. It creates unique identifiers to check if the ajax request is coming from website or not. In WordPress ...


0

To verify nonces in Ajax requests, check_ajax_referrer() should be used instead of wp_verify_nonce(): Crete the nonce: $nonce = wp_create_nonce( 'vote-nonce-' . get_the_ID() ); Include it in JavaScript: jQuery(document).ready(function(){ jQuery(".post-voting").click(function(){ vote_nonce = <?php echo $nonce; ?> vote_id = jQuery(this)....



Top 50 recent answers are included