有什么想法为什么woocommerce重定向到404消息?

时间:2014-03-18 00:27:11

标签: wordpress woocommerce

我知道为什么我的woocommerce商店会重定向到以下网址:http://website.com/checkout/order-received/092/?key=order_53278f779fde2而不是:http://website.com/checkout/order-received/

我希望能够做到这一点的重定向功能。这就是我的想法:

add_function_woocommerce_redirect_url_something

我也试图改变固定链接而没有运气!!

2 个答案:

答案 0 :(得分:0)

add_filter('woocommerce_get_checkout_order_received_url','my_order_received_url',0,2);
function my_order_received_url($return_url,$order){
    $return_url = str_replace('?','&',$return_url);
    $return_url = str_replace('/order-received/','/?order-received=',$return_url);
    return $return_url;
}

答案 1 :(得分:0)

add_filter('woocommerce_get_checkout_order_received_url','my_order_received_url',0,2);
function my_order_received_url($return_url, $order){
    if( preg_match('~/order\-received/\d+\?~', $return_url) ){
        $return_url = str_replace('?','&',$return_url);
        $return_url = str_replace('/order-received/','/?order-received=',$return_url);
    }
    return $return_url;
}