Advertisement
nuphunk

Bulk actions

Oct 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. $postType = "post";
  2.  
  3.  
  4. add_filter("bulk_actions-edit-" . $postType, function ($actions) {
  5.  
  6. $actions["specialSave"] = "Special save";
  7.  
  8. return $actions;
  9.  
  10. }, 20);
  11.  
  12.  
  13. add_filter("handle_bulk_actions-edit-" . $postType, function ($sendback, $doaction, $post_ids) {
  14.  
  15. if ("specialSave" !== $doaction) {
  16. return;
  17. }
  18.  
  19. foreach ($post_ids as $idPost) {
  20.  
  21. // action to do for each selected post
  22.  
  23.  
  24.  
  25. }
  26.  
  27. return $sendback;
  28.  
  29.  
  30. }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement