Custom post type ‘articles’ ignores posts_per_page, reserved post_type?

I have a head-scratcher! I have a number of different post types, the default post/page/attachment + a handful created with the default CPT UI settings. Just one of them (articles) is misbehaving, with the WP_Query posts_per_page argument being ignored.

I cannot find anything about reserved post slugs, aside from the usual suspects mentioned above.

So, we have a bunch of post_type=articles. To test, I went into the DB and changed 3 of those to article – removing the s. Though I haven’t created the post type in CPT IU, or in functions, WP_Query is able to return it… correctly no less!

$a_articles__featured = array (
‘post_type’ => ‘articles’,
‘nopaging’ => false,
‘posts_per_page’ => 2,
‘update_post_term_cache’ => false,
‘update_post_meta_cache’ => false
);
$q_articles__featured = new WP_Query( $a_articles__featured );

^^^ returns ALL posts with the CPTUI post_type of articles

$a_articles__featured = array (
‘post_type’ => ‘article’,
‘nopaging’ => false,
‘posts_per_page’ => 2,
‘update_post_term_cache’ => false,
‘update_post_meta_cache’ => false
);
$q_articles__featured = new WP_Query( $a_articles__featured );

^^^ returns 2 posts with the manually adjusted post_type of article

$a_articles__featured = array (
‘post_type’ => ‘page’,
‘nopaging’ => false,
‘posts_per_page’ => 2,
‘update_post_term_cache’ => false,
‘update_post_meta_cache’ => false
);
$q_articles__featured = new WP_Query( $a_articles__featured );

^^^ returns 2 posts with the default post_type of page

$a_articles__featured = array (
‘post_type’ => ‘events’,
‘nopaging’ => false,
‘posts_per_page’ => 2,
‘update_post_term_cache’ => false,
‘update_post_meta_cache’ => false
);
$q_articles__featured = new WP_Query( $a_articles__featured );

^^^ returns 2 posts with the CPTUI post_type of events

Aside from just using article, which is a disruption in the URL, can anyone suggest trouble shooting from here?

Thank you!

Read more here:: Custom post type ‘articles’ ignores posts_per_page, reserved post_type?

Leave a Reply

Your email address will not be published. Required fields are marked *