Php Wordpress使用add_rewrite_rule()创建漂亮链接

Php Wordpress使用add_rewrite_rule()创建漂亮链接,php,wordpress,woocommerce,permalinks,Php,Wordpress,Woocommerce,Permalinks,我正在创建一个Wordpress Woocommerce网站,我想制作漂亮的链接 例如: http://maskshop.lt/parduotuve/?filter_pagal-efekta=drekinanti&query_type_pagal-efekta=或tohttp://maskshop.lt/efektas/drekinanti/or/ 这是我当前在functions.php中的代码: function custom_rewrite_rule() { add_rewrite_

我正在创建一个Wordpress Woocommerce网站,我想制作漂亮的链接

例如:

http://maskshop.lt/parduotuve/?filter_pagal-efekta=drekinanti&query_type_pagal-efekta=或
to
http://maskshop.lt/efektas/drekinanti/or/

这是我当前在functions.php中的代码:

function custom_rewrite_rule() {
    add_rewrite_rule('^efektas/([^/]*)/([^/]*)/?','index.php?page_id=299&filter_pagal-efekta=$matches[1]&query_type_pagal-efekta=$matches[2]','top');
}
add_action('init', 'custom_rewrite_rule', 10, 0);
主要问题是,当我转到
http://maskshop.lt/efektas/drekinanti/or/
我被重定向到商店,但没有一个过滤器处于打开(选中)状态。我正在使用商店页面中的过滤器小部件

那么,问题出在哪里呢