I previously had a custom post type called "Business" however the client needed this changed to "Listing", which I did (before we started adding a load of posts, luckily).

We now have over 100 posts under the "Listing" post type, however when I use the default loop on the archive-listing.php template as

$i = 0;
if (have_posts()) : while (have_posts()) : the_post();
    echo $i++ . " ";
endwhile; endif;

I only see 50 posts returned. More strange is that when I view the posts within Wordpress (by clicking "Listing" on the left hand menu), I see 50 posts on the first page (of 9 pages), even though I have set Screen settings > Number of items... to just 10.

I have visited and saved the permalinks page, so it's not that. Is this perhaps related to the name change of the custom post type early on, and if so, how do I resolve this at this late stage?

  • If you change the post_type and redirect the old urls to new? – Drupalizeme Nov 21 '17 at 12:10

I suggest you to debug first that whether the loop is carrying all posts or not. You may use print_r() and die combination. If it carries all posts fine then you may move to further steps of debugging.

Add pagination code. Because, if your loop do have all the posts with it then probably due to no pagination, you are missing other posts.

If still it doesn't show anything. Then, you need to share a screenshot of both the pages admin and frontend.

  • Turns out my issue was down to a pre_get_posts filter within my functions.php, but I'll accept this answer because it would be the case for most other similar issues. – wickywills Nov 21 '17 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.