【问题标题】:Hello! I want to redirect a category page from woocomerce to another page你好!我想将类别页面从 woocommerce 重定向到另一个页面
【发布时间】:2020-09-20 14:57:38
【问题描述】:

我想重定向 woocomerce 中的某个类别,因此当它被访问时(单击它)将用户引导到我选择的 wordpress 页面,而不是默认产品页面。我的类别是:/laptop-repair 和我想要什么时候被点击访问页面 :laptop-reparatie/ 这是在 wordpress 中创建的页面。我希望你能帮助我

【问题讨论】:

标签: wordpress url redirect categories


【解决方案1】:

函数so_38101215_template_redirect()
{

if( function_exists( 'is_product_category' ) && is_product_category( 'category' ) )  

{

    $redirect_page_id = 2022; // adjust to ID of page you are redirecting to  
    wp_redirect( get_permalink( $redirect_page_id ) );  
    exit();  
}

}

add_action('template_redirect', 'so_38101215_template_redirect');

我用我想要重定向的类别名称更改了“类别”。 它的工作。

【讨论】:

    猜你喜欢
    • 2021-04-04
    • 2015-08-14
    • 1970-01-01
    • 1970-01-01
    • 2016-12-14
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    相关资源
    最近更新 更多