0

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?

1
  • If you change the post_type and redirect the old urls to new? Commented Nov 21, 2017 at 12:10

1 Answer 1

1

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.

1
  • 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
    Commented Nov 21, 2017 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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