I have a custom admin page.

On it, I have created a filtered list of the custom post type based on postmeta data.

I have to create a link to delete that post.

I am trying to figure out how to create the link with a nonce.

sprintf('<a href="post.php?post=%s&action=%s&_wpnonce=%s" class="link-course-delete">Trash</a>',$item['ID'],'trash',wp_create_nonce(???))

I am not sure what value to pass to wp_create_nonce to make it work.

1 Answer 1


I found the answer - this contains sample code which helped me resolve the issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.