wc_is_current_account_menu_item()
Find current item in account menu.
No Hooks.
Return
true|false
.
Usage
wc_is_current_account_menu_item( $endpoint );
- $endpoint(string) (required)
- Endpoint.
Changelog
Since 9.3.0 | Introduced. |
wc_is_current_account_menu_item() wc is current account menu item code WC 9.4.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; }