I am struggling to implement nonces through XML request to php backend using the Wordpress nonce validation when creating forms dynamically. I am ok with the form built version
wp_nonce_field( 'delete-comment_'.$comment_id );
So I am trying to use the other nonce options when passing via javascript localization.
$nonce = wp_create_nonce( 'my-action_'.$post->ID );
Then to verify, there seems to be two options.
check_ajax_referer( 'process-comment' );
wp_verify_nonce( $_REQUEST['my_nonce'], 'process-comment'.$comment_id );
Both of which I seem unable to make recognised in the validation. There is a number being passed through the post, and I have tried, naming, not naming, and a lot of other options too, but seem unsuccessful to do something that is meant to be simple. The examples given on the codex are mightily confusing too.
eg: here https://codex.wordpress.org/WordPress_Nonces
Can anyone shed any light on this frustrating experience? Many Thanks