
內容簡介
自訂文章類型永久連結允許您編輯自訂文章類型的永久連結結構。
更改自訂分類目錄的永久鏈接,以“example.org/post_type/taxonomy_name/term_slug”的形式。可禁用此修復。
支援wp_get_archives( 'post_type=foo' )和文章類型日期檔案存檔(例如example.com/post_type_slug/date/2010/01/01)。
這款外掛已發佈在 GitHub 上。
捐款:請發送我的願望清單或Paypal
翻譯人員
日語(ja) – Toro_Unit
法語(fr_FR) – Geoffrey Crofte
俄語(ru_RU) – Olart、Natali_Z
請參閱
簡單文章類型永久連結
代碼設置
示例:
register_post_type( 'foo',
array(
'public' => true,
'has_archive' => true,
'rewrite' => array(
"with_front" => true
),
'cptp_permalink_structure' => '%post_id%'
)
);
排除特定的文章類型
add_filter( 'cptp_is_rewrite_supported_by_foo', '__return_false' );
// 或者
add_filter( 'cptp_is_rewrite_supported', function ( $support , $post_type ) {
if ( 'foo' === $post_type ) {
return false;
}
return $support;
}, 10, 2);
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Custom Post Type Permalinks allow you edit the permalink structure of custom post type.
Change custom taxonomy archive’s permalink to “example.org/post_type/taxonomy_name/term_slug”. Can disable this fix.
And support wp_get_archives( 'post_type=foo' ) and post type date archive (ex. example.com/post_type_slug/date/2010/01/01 ).
This Plugin published on GitHub.
Donation: Please send My Wishlist or Paypal
Translators
Japanese(ja) – Toro_Unit
French(fr_FR) – Geoffrey Crofte
Russian(ru_RU) – Olart, Natali_Z
Also checkout
Simple Post Type Permalinks
Setting on Code
Example:
register_post_type( 'foo',
array(
'public' => true,
'has_archive' => true,
'rewrite' => array(
"with_front" => true
),
'cptp_permalink_structure' => '%post_id%'
)
);
Exclude specific post type
add_filter( 'cptp_is_rewrite_supported_by_foo', '__return_false' );
// or
add_filter( 'cptp_is_rewrite_supported', function ( $support , $post_type ) {
if ( 'foo' === $post_type ) {
return false;
}
return $support;
}, 10, 2);
