0
0

More than 5 years have passed since last update.

【WordPress・プラグインなし】デフォルトの「投稿」(post)のアーカイブページを作成する方法

Last updated at Posted at 2019-03-25

デフォルトの「投稿」(post)のアーカイブ(記事一覧)ページは無効になっているため有効化します。

functions.php
function post_has_archive($args, $post_type){
    if('post' == $post_type){
        $args['rewrite'] = true;
        $args['has_archive'] = 'news'; //任意のスラッグ名
    }
    return $args;
}
add_filter('register_post_type_args', 'post_has_archive', 10, 2);

:heavy_plus_sign: 設定 > パーマリンク設定 > 変更を保存

この設定の場合は、http://サイトURL/news/でpostの一覧ページが表示できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0