Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
Products::possibly_add_load_sample_return_notice_script()
Adds a return to task list notice when completing the loading sample products action.
Метод класса: Products{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Products = new Products(); $Products->possibly_add_load_sample_return_notice_script( $hook );
- $hook(строка) (обязательный)
- Page hook.
Код Products::possibly_add_load_sample_return_notice_script() Products::possibly add load sample return notice script WC 9.5.1
public function possibly_add_load_sample_return_notice_script( $hook ) { if ( $hook !== 'edit.php' || get_query_var( 'post_type' ) !== 'product' ) { return; } $referer = wp_get_referer(); if ( ! $referer || strpos( $referer, wc_admin_url() ) !== 0 ) { return; } if ( ! isset( $_GET[ Task::ACTIVE_TASK_TRANSIENT ] ) ) { return; } $task_id = sanitize_title_with_dashes( wp_unslash( $_GET[ Task::ACTIVE_TASK_TRANSIENT ] ) ); if ( $task_id !== $this->get_id() || ! $this->is_complete() ) { return; } WCAdminAssets::register_script( 'wp-admin-scripts', 'onboarding-load-sample-products-notice', true ); }