2016-07-30 53 views

回答

0

在您的register_post_type中使用rewrite選項來更改url但不是cpt的實際名稱。這樣,你就不會遇到數據庫問題,你的用戶仍然會看到新的名字。從WordPress抄本

例子:

add_action('init', 'create_posttype'); 
function create_posttype() { 
    register_post_type('acme_product', 
    array(
     'labels' => array(
      'name' => __('Products'), 
      'singular_name' => __('Product') 
     ), 
     'public' => true, 
     'has_archive' => true, 
     'rewrite' => array('slug' => 'products'), 
    ) 
); 
} 

這裏,網址是/products/即使CPT的名字是acme_product