Rewrite nested urls for custom post type

I find a solution thank you to the plugin: Monkeyman Rewrite Rule With this plugin I find when the rule failed, then I corrected it with these lines of code: add_action( ‘init’, ‘ab_category_rewrite_rules’ ); function ab_category_rewrite_rules() { add_rewrite_tag( ‘%category%’, ‘([^/]+)’, ‘category=’ ); add_permastruct( ‘category’, ‘/catalogs/%catalog%/%category%’, false ); add_rewrite_rule( ‘^category/([^/]+)/([^/]+)/?$’, ‘index.php?category=$matches[2]’, ‘top’ ); } add_action( ‘init’, … Read more

How do loop categories post from according in WordPress? is it impossible to solve this problem?

Thanks all for help here the link about solved it bcworkz (@bcworkz) 37 minutes ago There are two issues I see. $cat_array is an array of IDs, not objects, so the ‘cat’ query arg should just be ‘cat’ => $cat, The other is when you use setup_postdata( $post ), you must explicitly declare global $post;