I've created a custom post-type in my theme, named portfolio. I've set the permalinks for my blog to be /blog/post-name
, and now by default my portfolio posts are /blog/portfolio/post-name
is there any way to take the blog part out of the portfolio url?
Wordpress自定义帖子类型网址与博客文章有单独的网址
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- doupishan3309 2013-09-23 16:32关注
One way would be using WP_Rewrite but there is no way of overriding the base path (
/blog
) as it's theRewriteBase /blog/
rule in the generated.htaccess
file. So either remove that base path and useWP_Rewrite
to add it back or manually edit.htaccess
and rewrite it, before theRewriteBase
directive:... RewriteBase / RewriteRule ^/blog/portfolio/(.*)$ http://example.com/portfolio/$1 [R=301,L] RewriteBase /blog/ ...
But I would not encourage this as WordPress will overwrite your changes the next time you submit the permalinks admin form.
So long story short: remove that
/blog/
basepath. If you don't know how to useWP_Rewrite
then you could register a new custom post type named "Blog Post" withblog
for theslug
parameter and use those instead of the default "Posts".解决 无用评论 打赏 举报
悬赏问题
- ¥15 python的qt5界面
- ¥15 无线电能传输系统MATLAB仿真问题
- ¥50 如何用脚本实现输入法的热键设置
- ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
- ¥30 深度学习,前后端连接
- ¥15 孟德尔随机化结果不一致
- ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
- ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
- ¥15 谁有desed数据集呀
- ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100