WORDPRESS:复制或重定向自定义帖子类型以具有分层URL

I'm using the Oshine template, which automatically creates custom post types and taxonomies.

The item i need to edit is portfolio

By default, portfolios have this url

/portfolio/portfolio-name

I'd need to have

/somepage/category/portfolio-name

From the theme options I can change it, but if I add slashes, I get 404!

I tried to add a rewrite in functions.php but no success.

Any ideas?

I added this to the functions.php

flush_rewrite_rules();
function custom_rewrite(){
    add_rewrite_rule('^arredo/(.*)/(.*)/?', 'portfolio/$matches[2]', 'top');
}
add_action("init", "custom_rewrite");

Basically I couldn't manually do what I needed.

But this plugin does

https://wordpress.org/plugins/custom-permalinks/