WooCommerce – Dashboard menu active class missing
-
On the Dashboard page (
/my-accountby default), Falang is preventing from setting theis-activeclass on the menu item:With Falang activated,
wp->query_varsis:Array
(
[falang_page] => my-account
[pagename] => my-account
)Without Falang,
wp->query_varsis:Array
(
[page] =>
[pagename] => my-account
)Setting the current flag on the Dashboard page expects
wp->query_varsto be empty or to contain apagekey.
Thepagekey is NOT present when Falang is activated.See below WooCommerce core function for reference:
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;
}
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.