fix(orders): route /orders without WP page (404)

Register commerce rewrite aliases and special-template bootstrap so
/orders loads page-orders even when no page is assigned; flush rules.
This commit is contained in:
kate522 committed 2026-07-25 13:40:56 +08:00
1 parent 3baa8573c9
commit 59901bdc26
4 files changed
+58 -4

No files matched your search

+7 -1
View File
@@ -74,7 +74,7 @@ endif;
if (!function_exists('aksrt_get_orders_page_url')) :
/**
* 订单中心页面 URL(模板 templates/pages/page-orders.php)。
* 未指派页面时回退 /orders/(与 Scripts 路由一致),保证「权益与消费」入口可用。
* 优先已绑定页面;否则回退固定 rewrite /orders/(template-registry + routing)。
*/
function aksrt_get_orders_page_url(): string {
$url = function_exists('aksrt_get_page_url_by_template')
@@ -83,6 +83,12 @@ function aksrt_get_orders_page_url(): string {
if ($url !== '') {
return $url;
}
if (function_exists('aksrt_get_template_url')) {
$boot = aksrt_get_template_url('orders');
if (is_string($boot) && $boot !== '' && $boot !== home_url('/')) {
return $boot;
}
}
return home_url('/orders/');
}
endif;