After a fresh WordPress installation, I was dumbfounded for a while when a simple “global $numposts; echo $numposts;
” would always print N+1 despite the total number of posts actually being N. Turns out I had forgot to delete the initial “About” page, which obviously isn’t listed among the posts, but among pages, yet gets included when $numposts
is calculated.
WordPress and wrong $numposts?
Written by
in