2016-07-30 6 views
0

こんにちは私はケーススタディですが、ポートフォリオとして名前を変更したいのですが、ケーススタディの下で10ポストを作成しました。実際に私はURLの変更をしたい..現在私のURLはhttp://www.praxinfo.com/case-studies-page/whatscrackin/ですが、私はhttp://www.praxinfo.com/portfolio/whatscrackin/が欲しいです。どのようにWordPressでこれを行うには?wordpressのcptの名前を変更

答えて

0

register_post_typeでは、rewriteオプションを使用して、cptの実際の名前ではなくURLを変更します。この方法では、データベースの問題に遭遇することはなく、ユーザーには引き続き新しい名前が表示されます。 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'), 
    ) 
); 
} 

、urlはCPTの名前はacme_productであっても/products/だろう。

関連する問題