[wp-hackers] get total of posts NOT in selected categories

Ashish Saini ashishsainiashfame at gmail.com
Wed Oct 20 15:51:03 UTC 2010


@Andrew
Codex says - The get_var function returns a single variable from the
database. Though only one variable is returned, the entire result of the
query is cached for later use.

So what is not being cached?

Thanks & Regards
Ashish Saini aka Ashfame
(Deserve Before You Desire)
Homepage : http://www.ashfame.com | Blog : http://blog.ashfame.com | Twitter
: http://twitter.com/ashfame


On Wed, Oct 20, 2010 at 7:59 PM, Andrew Nacin <wp at andrewnacin.com> wrote:

> On Wed, Oct 20, 2010 at 10:23 AM, John Blackbourn
> <johnbillion+wp at gmail.com <johnbillion%2Bwp at gmail.com><
> johnbillion%2Bwp at gmail.com <johnbillion%252Bwp at gmail.com>>
> > wrote:
>
> > On Wed, Oct 20, 2010 at 1:26 PM, Rich ZenMaster <richzenmaster at gmail.com
> >
> > wrote:
> > > Actually I don't need the list of posts. Just the post count.
> >
> > If you fetch the posts using get_posts() as Andrew suggested you can
> > then count() them to get the total. The added bonus will be that the
> > posts are added to WordPress' object cache.
>
>
> Especially important if you then need to display these posts.
>
> If you use WP_Query directly, you can use $my_query->post_count.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list