/* 新着記事一覧へ追加 */ function sample_pre_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query() ) { return; } elseif ( $query->is_home() ) { $query->set( 'post_type', [ 'post', 'news' ] ); return; } } add_action( 'pre_get_posts', 'sample_pre_get_posts' );