WooCommerce:在我的帐户页面中为自定义模板分配端点
2022-08-30 22:52:29
此功能将名为“特殊页面”的选项卡添加到“我的帐户”选项卡列表中:
add_filter( 'woocommerce_account_menu_items' , 'jc_menu_panel_nav' );
function jc_menu_panel_nav() {
$items = array(
'dashboard' => __( 'Dashboard', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce' ),
'downloads' => __( 'Downloads', 'woocommerce' ),
'edit-address' => __( 'Addresses', 'woocommerce' ),
'payment-methods' => __( 'Payment Methods', 'woocommerce' ),
'edit-account' => __( 'Account Details', 'woocommerce' ),
'special-page' => __( 'Special Page', 'woocommerce' ), // My custom tab here
'customer-logout' => __( 'Logout', 'woocommerce' ),
);
return $items;
}
这导致:
但是链接指向 ,并且自然给出 404 错误。my-account/special-page/
如何将此 URL 分配给名为 ?special-page.php