Wordpress Custom Permalink for Just Posts

前端 未结 1 1270
北荒
北荒 2020-12-09 11:04

My Wordpress install has three post types: pages, posts, and portfolio. The current structure is as follows:

  • page: example.com/page-name,
相关标签:
1条回答
  • 2020-12-09 11:43

    You simply have to set /blog/%postname%/ as your permalinks structure, this will not change your pages permalinks.

    And to keep your portfolio permalinks, you should set with_front to false when you register this post type.

    'with_front' => bool Should the permastruct be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true

    EDIT 1 : You should probably flush Wordpress rewrite rules after that.

    EDIT 2 : with_front param is a rewrite param :

    'rewrite' => array('slug' => 'portfolio', 'with_front' => false),
    
    0 讨论(0)
提交回复
热议问题