[wp-hackers] Using WP_Query to get posts ids

Steve Taylor steve at sltaylor.co.uk
Tue Sep 13 10:33:55 UTC 2011


You could use $wpdb->get_col, but I'm guessing you need the nice
querying API of WP_Query?

If it's for caching anyway, why not do the query (returning all data),
parse the IDs out into another var with a loop, and cache that var?


On 13 September 2011 09:25, Lox <lox.dev at knc.nc> wrote:
> Hello,
>
> I would like to use the power of the WP_Query class to select only posts ids
> from the database. I do not want to query for all fields and to have all
> queried posts cached, for performance reasons.
>
> Is that possible?
>
> Regards.
>
> --
> Lox
> lox.dev at knc.nc
> _______________________________________________
> 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