php - How to process bulk actions out of WP_List_Table class in Wordpress -


i'm extending wp_list_table in wordpress in plugin. i'm using example here: http://wordpress.org/plugins/custom-list-table-example/ base i'm doing. now, in example documentation says can process bulk actions wherever want, haven't found example shows how that.

specifically want process them in admin_action{$action} hook, , redirect table page.

is smart thing do? important, how can it? can provide example?

bulk action can implemented overwriting method get_bulk_actions() , returning associated array:

function get_bulk_actions() {   $actions = array(     'delete'    => 'delete'   );   return $actions; } 

you can find full details step step guide here

edited

to process bulk action, yes can use admin_action{$action} hook. if using simple action name(like edit, delete) thing need make sure is, put request verification code determine if request or not. way prevent interference name action prefixed plugin name (my_aswam_plugin_edit_action, my_aswam_plugin_delete_action). because request $action=your_action trigger hook.

add_action( 'admin_action_your_action', 'your_bulk_action_handler_function' );

function your_bulk_action_handler_function() {

 // stuff here  //make sure check sure request process  wp_redirect( $_server['http_referer'] ); exit();  

}

happy coding!


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -