Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

orion_pt on "query inside post - same arguments produces different request according to view"

$
0
0

I'm trying to get the image associated with a post's taxonomy, the following query works well when in taxonomy's view but it produces a different request when used in category view. Can anyone give me some help here? I'm not very familiar with wordpress...

$myquery = new WP_Query();
$myargs = array('post_type' => 'attachment','post_status' => 'inherit','posts_per_page'=> -1,'tax_query' => array(array('taxonomy' => 'autor-convidado', 'field' => 'id', 'terms' => $term_id )));
$myquery -> query($myargs);

request on taxonomy view:
SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (wp_posts.post_parent = p2.ID) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (485) ) AND wp_posts.post_type = 'attachment' AND ((wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'inherit'))) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order, wp_posts.post_date DESC;

request on category view:
SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (485) ) AND wp_posts.post_type IN ('post', 'nav_menu_item', 'produto', 'especialistas') AND (wp_posts.post_status = 'inherit') GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order, wp_posts.post_date DESC;


Viewing all articles
Browse latest Browse all 8245

Trending Articles