Title: 月別アーカイブのパーマリンクをリライトしたい
Last modified: 2016年11月6日

---

# 月別アーカイブのパーマリンクをリライトしたい

 *  [ng](https://ja.wordpress.org/support/users/nogud/)
 * (@nogud)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/%e6%9c%88%e5%88%a5%e3%82%a2%e3%83%bc%e3%82%ab%e3%82%a4%e3%83%96%e3%81%ae%e3%83%91%e3%83%bc%e3%83%9e%e3%83%aa%e3%83%b3%e3%82%af%e3%82%92%e3%83%aa%e3%83%a9%e3%82%a4%e3%83%88%e3%81%97%e3%81%9f%e3%81%84/)
 * いつもお世話になっております。
 * 作成したカスタム投稿タイプの月別アーカイブを表示させているのですが、そのパーマ
   リンク形式を変更したいと考えております。その方法をご助力いただけないでしょうか。
 *  – 月別アーカイブのパーマリンク形式
    現在：xxx.com/posttype/2016/04?post_type
   =posttype 変更後：xxx.com/posttype/aaa201604.html
 * 変更後のaaaは固定の文字列で、そのあとは年と日付の組み合わせです。
 * プラグインとしては、カスタム投稿タイプにCustom Post Type UIを。
    パーマリンク
   の設定にはCustom Post Type Permalinksを使用しております。
 * アーカイブの出力方法としては
 *     ```
       <?php wp_get_archives (array(
       'type' => 'monthly',
       'post_type' => 'posttype',
       'format' => 'option',
       'show_post_count' => true
       ));
       ?>
       ```
   
 * のようにしています。
    また、月の表示形式を2桁に変更するために下記のフィルター
   もfunction.phpに記載しております。
 *     ```
       add_filter('gettext', 'my_gettext', 20, 3);
       function my_gettext($translated_text, $original_text, $domain) {
           if ($original_text == '%1$s %2$d') {
               $translated_text = '%2$s.%1$02d';
           }
           $translated_text = str_replace('&nbsp;','',$translated_text);
           return $translated_text;
       }
       ```
   
 * ご助力いただけますと幸いです。
 * よろしくお願いいたします。

 トピック「月別アーカイブのパーマリンクをリライトしたい」には新たに返信することは
できません。

## タグ

 * [パーマリンク](https://ja.wordpress.org/support/topic-tag/%e3%83%91%e3%83%bc%e3%83%9e%e3%83%aa%e3%83%b3%e3%82%af/)
 * [リライト](https://ja.wordpress.org/support/topic-tag/%e3%83%aa%e3%83%a9%e3%82%a4%e3%83%88/)
 * [Custom Post Type Permalinks](https://ja.wordpress.org/support/topic-tag/custom-post-type-permalinks/)
 * [wp_get_archives](https://ja.wordpress.org/support/topic-tag/wp_get_archives/)
 * [月別アーカイブ](https://ja.wordpress.org/support/topic-tag/%e6%9c%88%e5%88%a5%e3%82%a2%e3%83%bc%e3%82%ab%e3%82%a4%e3%83%96/)

 * フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0件の返信
 * 1人の参加者
 * 最後の返信者: [ng](https://ja.wordpress.org/support/users/nogud/)
 * 最後の活動: [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/%e6%9c%88%e5%88%a5%e3%82%a2%e3%83%bc%e3%82%ab%e3%82%a4%e3%83%96%e3%81%ae%e3%83%91%e3%83%bc%e3%83%9e%e3%83%aa%e3%83%b3%e3%82%af%e3%82%92%e3%83%aa%e3%83%a9%e3%82%a4%e3%83%88%e3%81%97%e3%81%9f%e3%81%84/)
 * 状態: 未解決

## トピック

### 人気のトピック

### 返信がないトピック

### サポート関連ではないトピック

### 解決済みのトピック

### 未解決のトピック

### すべてのトピック
