Skip to content

Instantly share code, notes, and snippets.

@jjmontalban
Created May 11, 2021 10:37
Show Gist options
  • Save jjmontalban/f96ee82b7d0ee62079f170bee9d44c1c to your computer and use it in GitHub Desktop.
Save jjmontalban/f96ee82b7d0ee62079f170bee9d44c1c to your computer and use it in GitHub Desktop.
Redirigir a pedidos desde el principal del dashboard de /mi-cuenta
<?php
/**
* @snippet redirigir a pedidos desde el principal del dashboard de /mi-cuenta
* @author https://rudrastyh.com/woocommerce/remove-dashboard-from-my-account-menu.html#redirect-to-orders
*/
add_action('template_redirect', 'redirect_to_orders_from_dashboard' );
function redirect_to_orders_from_dashboard(){
if( is_account_page() && empty( WC()->query->get_current_endpoint() ) ){
wp_safe_redirect( wc_get_account_endpoint_url( 'orders' ) );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment