Automattic\WooCommerce\Admin\Features\OnboardingTasks
TaskLists::set_active_task()
Temporarily store the active task to persist across page loads when necessary. Most tasks do not need this.
Method of the class: TaskLists{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = TaskLists::set_active_task();
TaskLists::set_active_task() TaskLists::set active task code WC 9.7.1
public static function set_active_task() { if ( ! isset( $_GET[ Task::ACTIVE_TASK_TRANSIENT ] ) || ! current_user_can( 'manage_woocommerce' ) ) { // phpcs:ignore csrf ok. return; } $referer = wp_get_referer(); if ( ! $referer || 0 !== strpos( $referer, wc_admin_url() ) ) { return; } $task_id = sanitize_title_with_dashes( wp_unslash( $_GET[ Task::ACTIVE_TASK_TRANSIENT ] ) ); // phpcs:ignore csrf ok. $task = self::get_task( $task_id ); if ( ! $task ) { return; } $task->set_active(); }