This page redirects to an external site: https://developer.wordpress.org/reference/hooks/parse_request/
This action hook is executed at the end of WordPress's built-in request parsing method in the main WP() class.
Attention! Parse Request affects only the main query not queries made with wp_query, for example.
add_action( 'parse_request', 'change_post_per_page_wpent' );
function change_post_per_page_wpent( $query ) {
if ( 'my_cpt' == $query->query_vars['post_type'] ) {
$query->query_vars[ 'posts_per_page' ] = 3;
}
return $query;
}
The 'parse_request' hook is found in /wp-includes/class-wp.php, within the parse_request() method of the WP() class.