[WordPress] 外掛分享: Custom Post Type Permalinks

首頁外掛目錄 › Custom Post Type Permalinks
WordPress 外掛 Custom Post Type Permalinks 的封面圖片
200,000+
安裝啟用
★★★★
4.8/5 分(71 則評價)
537 天前
最後更新
問題解決
WordPress 6.1+ PHP 7.4+ v3.5.3 上架:2011-12-02

內容簡介

自訂文章類型永久連結允許您編輯自訂文章類型的永久連結結構。

更改自訂分類目錄的永久鏈接,以“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);

外掛標籤

開發者團隊

⬇ 下載最新版 (v3.5.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Custom Post Type Permalinks」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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);

延伸相關外掛

文章
Filter
Apply Filters
Mastodon