• Hi, I’m new to nonces and I’m using the code from https://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/

    This uses wp_localize_script() to get the nonce into javascript, this is working fine and dandy but if I add an

    alert(MyAjax.postCommentNonce);

    in my javascript, the alert is the same for every page… Shouldn’t the nonce be different for every form/action?

    I tried

    wp_create_nonce( 'ajax-nonce-' . $post->ID; )

    But some of the admin pages have the same page id so this doesn’t work.

  • The topic ‘WP Nonces’ is closed to new replies.