Change the number of posts for a WordPress custom post type archive page

Original link: https://www.wpdaxue.com/change-the-number-of-articles-of-the-wordpress-cpt.html

wpdaxue840.jpg

Typically, the number of articles displayed per page defaults to the value displayed on the Dashboard Settings > Reading > Blog page at most, which you may want for regular articles, but not for custom article types. To change the number of posts displayed in the archive page for a custom post type, you can do so using the pre_get_posts operation with some incoming parameters. Custom post type archive page pre_get_posts is like a pre-filter for the main query that runs on the page – if you’re going to change a page like this, it’s best to use pre_get_po…

This article is reprinted from: https://www.wpdaxue.com/change-the-number-of-articles-of-the-wordpress-cpt.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment