Hi @brunobns
Open your theme’s functions.php file and at the very top of the file add the following 2 lines:
use Brain\Cortex\Route\RouteCollectionInterface;
use Brain\Cortex\Route\QueryRoute;
At the bottom of the file, add the following code
add_action(
'cortex.routes',
function( RouteCollectionInterface $routes ) {
$account_page_id = wpum_get_core_page_id( 'account' );
$exists = ( 'publish' == get_post_status( $account_page_id ) ) ? true : false;
if ( ! $account_page_id || ! $exists ) {
return;
}
$page_slug = esc_attr( get_post_field( 'post_name', intval( $account_page_id ) ) );
$hierarchy = wpum_get_full_page_hierarchy( $account_page_id );
if ( ! empty( $hierarchy ) && is_array( $hierarchy ) ) {
$page_slug = '';
foreach ( array_reverse( $hierarchy ) as $page ) {
$parent_page_slug = esc_attr( get_post_field( 'post_name', intval( $page['id'] ) ) );
$page_slug .= $parent_page_slug . '/';
}
}
$routes->addRoute(
new QueryRoute(
'{lang:[a-zA-Z0-9_.-]+}/' . $page_slug . '{tab:[a-zA-Z0-9_.-]+}',
function( array $matches ) use ( $account_page_id ) {
return [
'tab' => $matches['tab'],
'page_id' => $account_page_id,
];
}
)
);
}
);
This code basically just tells WPUM “there’s something else before the page slug in the url” but it doesn’t actually do anything with it.
Let me know how it goes.