WordPress at Your Fingertips
function is not described

WC_Privacy_Background_Process::task() protected WC 1.0

Code to execute for each item in the queue

{} It's a method of the class: WC_Privacy_Background_Process{}

No Hooks.

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->task( $item );
$item(string) (required)
Queue item to iterate over.

Code of WC_Privacy_Background_Process::task() WC 5.6.0

protected function task( $item ) {
	if ( ! $item || empty( $item['task'] ) ) {
		return false;
	}

	$process_count = 0;
	$process_limit = 20;

	switch ( $item['task'] ) {
		case 'trash_pending_orders':
			$process_count = WC_Privacy::trash_pending_orders( $process_limit );
			break;
		case 'trash_failed_orders':
			$process_count = WC_Privacy::trash_failed_orders( $process_limit );
			break;
		case 'trash_cancelled_orders':
			$process_count = WC_Privacy::trash_cancelled_orders( $process_limit );
			break;
		case 'anonymize_completed_orders':
			$process_count = WC_Privacy::anonymize_completed_orders( $process_limit );
			break;
		case 'delete_inactive_accounts':
			$process_count = WC_Privacy::delete_inactive_accounts( $process_limit );
			break;
	}

	if ( $process_limit === $process_count ) {
		// Needs to run again.
		return $item;
	}

	return false;
}