Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskLists::add_task()public staticWC 1.0

Add task to a given task list.

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

No Hooks.

Return

WP_Error|Task.

Usage

$result = TaskLists::add_task( $list_id, $args );
$list_id(string) (required)
List ID to add the task to.
$args(array) (required)
Task properties.

Code of TaskLists::add_task() WC 6.8.2

public static function add_task( $list_id, $args ) {
	if ( ! isset( self::$lists[ $list_id ] ) ) {
		return new \WP_Error(
			'woocommerce_task_list_invalid_list',
			__( 'Task list ID does not exist', 'woocommerce' )
		);
	}

	self::$lists[ $list_id ]->add_task( $args );
}