[wp-hackers] Unexpected behaviour in WP_Query

Peter Westwood peter.westwood at ftwr.co.uk
Wed Feb 4 18:25:07 GMT 2009


On 4 Feb 2009, at 18:22, Sudar Muthu wrote:

>>
>> I think $post->post_category is a fossil from older versions and  
>> doesn't
>>
> serve any purpose.
>>
>
> If that is the case, then is there a way to retrieve the category  
> of the
> post without using wp_get_post_categories($post->ID); function call?
>

A post is not necessarily in a single category.

You could do it with some manual SQL probably, but you shouldn't!

Use the API available and call wp_get_post_categories.

westi
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list