wc_is_current_account_menu_item()
Find current item in account menu.
Хуков нет.
Возвращает
true|false
.
Использование
wc_is_current_account_menu_item( $endpoint );
- $endpoint(строка) (обязательный)
- Endpoint.
Список изменений
С версии 9.3.0 | Введена. |
Код wc_is_current_account_menu_item() wc is current account menu item WC 10.0.2
function wc_is_current_account_menu_item( $endpoint ) { global $wp; $current = isset( $wp->query_vars[ $endpoint ] ); if ( 'dashboard' === $endpoint && ( isset( $wp->query_vars['page'] ) || empty( $wp->query_vars ) ) ) { $current = true; // Dashboard is not an endpoint, so needs a custom check. } elseif ( 'orders' === $endpoint && isset( $wp->query_vars['view-order'] ) ) { $current = true; // When looking at individual order, highlight Orders list item (to signify where in the menu the user currently is). } elseif ( 'payment-methods' === $endpoint && isset( $wp->query_vars['add-payment-method'] ) ) { $current = true; } return $current; }