You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

移除WooCommerce面包屑中Home/Shop或保留Shop的简便方案

WooCommerce面包屑简化解决方案

方法一:用代码片段快速调整(无需复杂自定义)

直接通过WooCommerce的钩子修改面包屑内容,两种场景可选:

  1. 只保留Shop作为起始项,移除Home
    将以下代码添加到主题的functions.php文件末尾,或者用「Code Snippets」插件新建代码片段启用:
add_filter( 'woocommerce_get_breadcrumb', 'custom_remove_home_breadcrumb' );
function custom_remove_home_breadcrumb( $crumbs ) {
    // 移除第一个Home项
    if ( isset( $crumbs[0] ) ) {
        array_shift( $crumbs );
    }
    return $crumbs;
}
  1. 直接从具体分类/子分类/产品开始,移除Home和Shop
    如果不需要Shop开头,用这段代码:
add_filter( 'woocommerce_get_breadcrumb', 'custom_remove_home_shop_breadcrumb' );
function custom_remove_home_shop_breadcrumb( $crumbs ) {
    // 移除前两项(Home和Shop)
    if ( count( $crumbs ) > 2 ) {
        array_shift( $crumbs );
        array_shift( $crumbs );
    }
    return $crumbs;
}

方法二:用插件可视化调整(零代码)

如果不想碰代码,直接在WordPress后台插件库搜索「WooCommerce Breadcrumb Customizer」这类插件,安装启用后,在插件设置里就能直接勾选移除Home/Shop项,或者调整面包屑的起始节点,全程可视化操作。


内容的提问来源于stack exchange,提问作者Raphael Fiquet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 08:12:40