Different permalink structure for blog posts than pages in Wordpress?

痴心易碎 提交于 2019-12-05 22:39:45

问题


I'd like to have a different permalink structure for posts than for pages on a Wordpress website.

For example, a blog post name "This is a nice blog post" would get the permalink : /blog/this-is-a-nice-blog-post

where as a page called "Services Offered" would get the permalink : /services-offered

I know I should use the %postname% in the permalink structure, but how to add the prefix /blog/ to only those blog posts ?

Thanks in advance!


回答1:


Under the permalink settings, you need to use a custom format. To do this, you'll need to take a look at the structure tags available for use. Those can be found here:

http://codex.wordpress.org/Using_Permalinks

To do exactly what you're wanting, you'd want to use a format like this:

/%category%/%postname%/

Pages have no category, so the tag for categories gets ignored and only the post name tag gets used.

I just found this question looking for the same answer. Hope this isn't too late and helps you out.



来源:https://stackoverflow.com/questions/5874482/different-permalink-structure-for-blog-posts-than-pages-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!