wordpress - Wordpress - 自定义分类重写 URL
问题描述
如何重写自定义分类法的 URL(分类法已从主题注册)?
实际网址:domain.com/doctor/dentist/?llocs=peje(llocs=peje 是位置,其中 peje 是位置名称)
如果可能的话,我想要什么:domain.com/peje/doctor/dentist/ 或 domain.com/doctor/dentist/peje
如果我的问题不清楚,请随时问我更多。
谢谢!
解决方案
您可以在注册分类时编写重写规则。试试这个代码 -
register_taxonomy('type', 'mytest', array(
'labels' => array(
'name' => 'Types'
, 'singular_name' => 'Type'
, 'search_items' => 'Search Types'
, 'edit_item' => 'Edit Type'
, 'add_new_item' => 'Add New Type'
)
, 'hierarchical' => true
, 'query_var' => true
, 'rewrite' => array('slug' => 'mytest/type', 'with_front' => false)
)); // type taxonomy
推荐阅读
- google-chrome-extension - 用户关闭 Chrome 时关闭本机主机
- alexa - 如何对因 INVALID_REQUEST_EXCEPTION 失败的 ASK ChangeReport 进行故障排除
- firebase - Fabric 中的重复事件流到 Firebase-> Google Big Query 流
- reactjs - 有没有办法可以使用 uri 而不是对 React Native Prop 类型的要求?
- swift - 如何在没有扫描功能的情况下保留 Rx 中的状态
- python - 如何将字符串(带换行符)转换为 HTML?
- android - 没有backstack的共享元素返回动画
- java - 返回里面试试
- python - 如何从 Python 向同一个长时间运行的 AWS Lambda 函数发出多个 HTTP RequestResponse 请求?
- node.js - sails.js 如何让 _csrf 在 vuejs 中使用