Please thoroughly read the WP_Query
docs, especially that part about post types. Means you need to pass the query the post type you want to query:
$args = array(
'post_type' => 'my_custom_post_type',
'posts_per_page' => 1,
);
$query = new WP_Query( $args );
Even better it would be to simply override the existing query for that archive page by hooking into pre_get_posts
. This will for example also adjust the pagination accordingly. Place this in your functions.php
:
/**
* Override the main query on a custom post type archive.
*
* @param \WP_Query $wp_query
*/
function wpse_337567( WP_Query $wp_query ) {
// Only check this on the main query.
if ( $wp_query->is_main_query() && is_post_type_archive( 'my_custom_post_type' ) && !is_admin() ) {
$query->set( 'posts_per_page', 1 );
}
}
add_action( 'pre_get_posts', 'wpse_337567' );