【发布时间】:2020-11-09 15:18:32
【问题描述】:
我想重写网址
https://example.com/arenda-avtomobilej-2/?min_price=300&max_price=1200&limo-vip=on&wwf=on
到
https://example.com/arenda-avtomobilej-2/somepage/
并将所有获取参数保存到查询变量。
有人可以帮忙吗?
【问题讨论】:
我想重写网址
https://example.com/arenda-avtomobilej-2/?min_price=300&max_price=1200&limo-vip=on&wwf=on
到
https://example.com/arenda-avtomobilej-2/somepage/
并将所有获取参数保存到查询变量。
有人可以帮忙吗?
【问题讨论】:
add_rewrite_rule() [see]
添加将 URL 结构转换为一组查询变量的重写规则。
add_action('init', function() {
add_rewrite_rule( 'min_price/([0-9]+)[/]?$', 'index.php?min_price=$matches[1]', 'top' );
} );
// https://example.com/arenda-avtomobilej-2/min_price/800
【讨论】: