Php 通过add_url_rewrite从自定义分类和自定义帖子类型中删除slug
问题: 有一个名为product_category的自定义分类法和一个名为slug as product的自定义帖子类型。现在url看起来是这样的 example.com/categories/laptop 和产品职位 example.com/product/laptop/acer/acerlaptopname 现在我想让他们表现得像这样: example.com/laptop 同样地 example.com/laptop/acer/acerlaptopname 尝试过的解决方案:Php 通过add_url_rewrite从自定义分类和自定义帖子类型中删除slug,php,wordpress,.htaccess,url-rewriting,custom-post-type,Php,Wordpress,.htaccess,Url Rewriting,Custom Post Type,问题: 有一个名为product_category的自定义分类法和一个名为slug as product的自定义帖子类型。现在url看起来是这样的 example.com/categories/laptop 和产品职位 example.com/product/laptop/acer/acerlaptopname 现在我想让他们表现得像这样: example.com/laptop 同样地 example.com/laptop/acer/acerlaptopname 尝试过的解决方案: 使用.hta
example.com/laptop/acer/acerlaptopname --> as needed
及
两人都在跑步
添加操作('init',函数()
{
添加重写规则(“^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$”,“index.php?post_type=product&product_category=$matches[1]&product_brand=$matches[2]&name=$matches[3],“top”);
}, 0, 0);
?>
example.com/product/laptop/acer/acerlaptopname --> not needed