Arielle Lewis
Arielle Lewis

Reputation: 540

Verifying nonce from WP_List_Table

I'm setting up bulk actions in a WordPress plugin using WP_List_Table. The only bulk action I want to allow is delete. I have a link to delete items that passes a nonce generated with

wp_create_nonce( 'deletePoll' )

When I click the link it works just fine. I'm verifying it in the processing code with

check_admin_referer( 'deletePoll' );

But when I use the bulk action form to try to delete I get the are you sure you want to do this? message.

I looked in wp-admin/post.php to see how they handle this with trashing items, and it seems to be exactly the same, except it works.

Upvotes: 5

Views: 1655

Answers (1)

OGZCoder
OGZCoder

Reputation: 285

why not use

wp_verify_nonce( $nonce, 'bulk-' . $this->_args['plural'] ) );

https://codex.wordpress.org/Function_Reference/wp_verify_nonce

Upvotes: 3

Related Questions