add_permastruct page not found for taxonomies.


I have a wired problem that I don’t understand.

I have a custom post type that has a permastruct of ‘portfolio/{$portfolio_project}’ and category taxonomy that has a permastruct of 'portfolio/categories/{$portfolio_category}

If I acess the cateogory for example portfolio/categories/my-category the theme returns ‘page not found’ it is basically searching in the portfolio custom post type instead of the cateogry taxonomy, can anybody explain why ?

$pionier_port_base    = esc_html__('portfolio', 'pionier');
$pionier_tax_base     = esc_html__('categories', 'pionier');
add_rewrite_tag('%pionier_portfolio%', '([^&/]+)', 'pionier_portfolio=');
add_rewrite_tag('%pionier_category%', '([^&/]+)', 'pionier_category=');

add_permastruct('pionier_portfolio', "{$pionier_port_base}/%pionier_portfolio%", false);
add_permastruct('pionier_category', "{$pionier_port_base}/{$pionier_tax_base}/%pionier_category%", false);