內容簡介
此外,除了控制自訂文章類型的永久網址,此外掛還支援在您的永久網址結構中使用自訂分類。
不僅如此,您還可以控制完整的永久網址,使文章類型別名不需要出現在連結開頭。
多個文章類型可以使用相同的永久網址結構。
使用方式
此外掛有兩種使用方式:
永久網址設定
此外掛會為任何公開的自訂文章類型在永久網址設定頁面新增欄位。
程式碼中使用
當註冊文章類型時,您可以在重寫屬性中使用值來定義您的預設永久網址結構,此鍵為「permastruct」。
例如:
<?php
register_post_type( 'my_type', array(
...
'rewrite' => array(
'permastruct' => '/%custom_taxonomy_name%/%author%/%postname%/'
),
...
) );
?>
外掛標籤
開發者團隊
原文外掛簡介
In addition to controlling your custom post type permalinks this plugin adds support for using custom taxonomies in your permalink structures as well.
Not only that but you can control the full permalink so the post type slug is not required at the start of the link.
Multiple post types can use the same permalink structure.
Usage
There are 2 ways to use this plugin:
Permalink Settings
The plugin adds fields to the permalinks settings page for any public facing custom post types.
In Code
When registering a post type you can add a value to the rewrite property with the key ‘permastruct’ to define your default permalink structure.
eg:
array(
'permastruct' => '/%custom_taxonomy_name%/%author%/%postname%/'
),
...
) );
?>
