[wp-hackers] Get_post and Wp_Query

Lox lox.dev at knc.nc
Thu Aug 19 17:34:36 UTC 2010


I extend a custom post_type with data from a custom table using posts_where,
posts_join etc.

To detect whether I have to extend the queried post, I use the WP_Query:

function posts_fields ($fields, WP_Query $wp_query) {

        if($wp_query->query_vars['post_type'] == 'my_post_type' ) {

So, if I call WP_Query with a post_type='my_post_type' it is ok. But if I
call get_post() function, post_type query vars is not passed to the query
and thus my post_type doesn't get extended with data from my custom table.

Any workaround to have get_post extend my postype ?


lox.dev at knc.nc

More information about the wp-hackers mailing list