0
這使我瘋狂。自定義帖子類型slu conflicts與另一種帖子類型衝突
我有兩個自定義文章類型
register_post_type('products',
array(
'labels' => array(
'name' => __('Products'),
'singular_name' => __('Product')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'products'),
)
);
register_post_type('markets',
array(
'labels' => array(
'name' => __('Markets'),
'singular_name' => __('Market')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'markets'),
)
);
和兩個模板(歸檔products.php和歸檔markets.php)
的products
自定義類型的作品。存檔頁面正確顯示,但單個頁面不顯示。如果我刪除市場上的register_post_type
,則產品的單頁工作。
但是,markets
類型的網址爲www.website.com/products/a-market-post
這真的很奇怪,因爲它使用產品帖子類型中的slu g。
有誰知道可能發生了什麼?我刷新了固定鏈接頁面1000次,並沒有做任何事情。
乾杯!
什麼是您的永久鏈接結構? –
你在哪裏放置代碼?在一個函數在init鉤子上觸發? –
@MohammadAshiqueAli月份和名稱 – Splurtcake