permalinks - Make query parameter an endpoint

i want to add custom part at the end of permalinklike thisi wantredirect tothanks for alli want to add custom part at th

i want to add custom part at the end of permalink

like this


i want


redirect to


thanks for all

i want to add custom part at the end of permalink

like this

https://example/product/product-name/order

i want

https://example/product/product-name?order=1

redirect to

https://example/product/product-name/order

thanks for all

Share Improve this question edited Jul 2, 2019 at 5:44 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Jul 2, 2019 at 4:06 Dev Ahmed HassanDev Ahmed Hassan 1
Add a comment  | 

1 Answer 1

Reset to default 0

You need to put this code into your product single page before get_header() function start.

<?php
global $wp;
if( isset($_SERVER['QUERY_STRING']) && isset($_GET['order']) ){
    $url = home_url( $wp->request . '/order/' );
    wp_safe_redirect( $url );
    exit;
}
?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745352711a4623930.html

相关推荐

  • permalinks - Make query parameter an endpoint

    i want to add custom part at the end of permalinklike thisi wantredirect tothanks for alli want to add custom part at th

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信