ActionScheduler_Abstract_ListTable::process_bulk_action()protectedWC 1.0

Checks if the current request has a bulk action. If that is the case it will validate and will execute the bulk method handler. Regardless if the action is valid or not it will redirect to the previous page removing the current arguments that makes this request a bulk action.

Method of the class: ActionScheduler_Abstract_ListTable{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->process_bulk_action();

ActionScheduler_Abstract_ListTable::process_bulk_action() code WC 9.3.3

protected function process_bulk_action() {
	global $wpdb;
	// Detect when a bulk action is being triggered.
	$action = $this->current_action();
	if ( ! $action ) {
		return;
	}

	check_admin_referer( 'bulk-' . $this->_args['plural'] );

	$method = 'bulk_' . $action;
	if ( array_key_exists( $action, $this->bulk_actions ) && is_callable( array( $this, $method ) ) && ! empty( $_GET['ID'] ) && is_array( $_GET['ID'] ) ) {
		$ids_sql = '(' . implode( ',', array_fill( 0, count( $_GET['ID'] ), '%s' ) ) . ')';
		$id      = array_map( 'absint', $_GET['ID'] );
		$this->$method( $id, $wpdb->prepare( $ids_sql, $id ) ); //phpcs:ignore WordPress.DB.PreparedSQL
	}

	if ( isset( $_SERVER['REQUEST_URI'] ) ) {
		wp_safe_redirect(
			remove_query_arg(
				array( '_wp_http_referer', '_wpnonce', 'ID', 'action', 'action2' ),
				esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) )
			)
		);
		exit;
	}
}