WordPressの投稿アーカイブを任意のURLで出力する方法について

パーマリンクを変更する方法 WordPressの標準の投稿アーカイブページは、/archives/というURLで表示されます。これを任意のURLに変更することができます。以下のコードをfunctions.phpに追加してください。

function post_has_archive( $args, $post_type ) {
    if ( 'post' == $post_type ) {
        $args['rewrite'] = true
        $args['has_archive'] = '好きな任意のスラッグを入れてください';
    }
    return $args;
}
add_filter( 'register_post_type_args', 'post_has_archive', 10, 2 );

※必ず、管理画面のパーマリンクの設定を更新します。

● 関連リンク
https://blog.8bit.co.jp/?p=18433
https://fundemic.jp/blog/the-tohr-archive/
https://lpeg.info/wordpress/archive.html