/**
  * Execute a bulk action on a single post
  *
  * @param string $action
  * @param int    $post_id
  */
 protected function execute_action($action, $post_id)
 {
     parent::execute_action($action, $post_id);
     do_action('cuar/core/admin/content-list-table/do-bulk-action?post_type=' . $this->post_type, $post_id, $action, $this);
 }
Example #2
0
 /**
  * Execute the bulk action on all selected posts
  */
 public function process_bulk_action()
 {
     if (isset($_REQUEST['delete_all']) && !empty($_REQUEST['delete_all'])) {
         if (!current_user_can('delete_posts')) {
             wp_die(__('You are not allowed to delete logs.', 'cuar'));
         }
         $post_ids = get_posts(array('post_type' => CUAR_LogEvent::$POST_TYPE, 'posts_per_page' => -1, 'fields' => 'ids'));
         if (!is_wp_error($post_ids)) {
             foreach ($post_ids as $post_id) {
                 wp_delete_post($post_id, true);
             }
         }
         return;
     }
     parent::process_bulk_action();
 }