6

Wordpressにカスタムpost_typeを追加しており、パーマリンク構造を次のようにしたいと思います。

/%post_type%/%year%/%monthnum%/%postname%/

日付タグを追加する方法がわかりません。このコードを使用して、私に与えます/my_type/example-post-slug/

register_post_type( 'customtype', array(
    ...other options...
    'rewrite' => array('slug' => 'my_type'),
));

日付を含めるにはどうすればよいですか?

4

4 に答える 4

2

これはプラグインCustom Post Type Permalinksで実現できます。プラグインをインストールして、設定でパーマリンク形式を変更するだけです。

于 2016-05-21T14:35:01.003 に答える
-3

これを使用すると、100% 動作します:

'rewrite' => array('slug'=>date('Y').'/'.date('m').'/custom_post_type_slug','with_front'=>true)
于 2015-07-13T15:37:46.203 に答える