Custom WP List Table with custom bulk actions
-
I’m working with two WP aspects that are new to me: WP List Table and custom bulk actions.
I’m building a small plugin for a Woocommerce installation that includes a custom WP_Lists_Table. I added a couple custom bulk actions. Executing a bulk action does nothing at all. I put
error_log
messages in the bulk action handler function for debugging, but nothing. The actions are listed in the drop-down bulk actions menu.I took the bulk actions code from my plugin, modified for the default WP edit post screen, and it works as expected there, returning the error log messages and the admin notice.
Not sure if it has to do with the screen id, which is
woocommerce_page_tkwd-wc-my-plugin
.Or maybe it’s my implementation of the list table.
The URL on initial page load:
https://localhost/wordpress-4/wp-admin/admin.php?page=tkwd-wc-my-plugin
After bulk actions Apply with two records selected (slashes are encoded):
https://localhost/wordpress-4/wp-admin/admin.php?s&_wpnonce=180992d0f0&_wp_http_referer=%2Fwordpress-4%2Fwp-admin%2Fadmin.php%3Fpage%3Dtkwd-wc-my-plugin&action=hidden&paged=1&user[0]=5&user[1]=4&action2=-1&page=tkwd-wc-my-plugin
The action value and record IDs are passed to the URL, but that’s all.
It’s seems the handler function just isn’t firing.
Bulk actions code:
https://pastebin.com/evJ2cr3QWP List Table code:
https://pastebin.com/zx7BrdDrWP List Table relevant markup:
https://pastebin.com/zczVDapjAny help or suggestions greatly appreciated!
- The topic ‘Custom WP List Table with custom bulk actions’ is closed to new replies.