admin管理员组文章数量:1026900
I am trying to use $wp_query->tax_query right out of the box as tax_query parameter, however I cannot work this out. The parameters for my new WP_Query is actually the same as the default query of the archive page I am in. I can not, however, use the default query since I am using a custom template for my post items.
Currently I define my tax_query this way:
array('tax_query' => $wp_query->tax_query)
Which is properly merged with the rest of my query, leaving this as the whole query:
Array
(
[post-type] => am-curso
[pagination] => 1
[tags] =>
[order-by] => title
[order] => asc
[tax_query] => WP_Tax_Query Object
(
[queries] => Array
(
[0] => Array
(
[taxonomy] => am-course-category
[terms] => Array
(
[0] => cursos-de-atualizacao
)
[field] => slug
[operator] => IN
[include_children] => 1
)
)
[relation] => AND
[table_aliases:protected] => Array
(
[0] => am_4_term_relationships
)
[queried_terms] => Array
(
[am-course-category] => Array
(
[terms] => Array
(
[0] => cursos-de-atualizacao
)
[field] => slug
)
)
[primary_table] => am_4_posts
[primary_id_column] => ID
)
)
How can I get the query out of the WP_Tax_Query object? If I go down to queries like so: $wp_query->tax_query->queries[0]
, I still doesn't work.
I believe it might work if get the array in queries
property and merge one layer above at tax_query
. However I don't want to do this manually if there may be any already built-in way (which I seem not to be able to find anywhere).
I am trying to use $wp_query->tax_query right out of the box as tax_query parameter, however I cannot work this out. The parameters for my new WP_Query is actually the same as the default query of the archive page I am in. I can not, however, use the default query since I am using a custom template for my post items.
Currently I define my tax_query this way:
array('tax_query' => $wp_query->tax_query)
Which is properly merged with the rest of my query, leaving this as the whole query:
Array
(
[post-type] => am-curso
[pagination] => 1
[tags] =>
[order-by] => title
[order] => asc
[tax_query] => WP_Tax_Query Object
(
[queries] => Array
(
[0] => Array
(
[taxonomy] => am-course-category
[terms] => Array
(
[0] => cursos-de-atualizacao
)
[field] => slug
[operator] => IN
[include_children] => 1
)
)
[relation] => AND
[table_aliases:protected] => Array
(
[0] => am_4_term_relationships
)
[queried_terms] => Array
(
[am-course-category] => Array
(
[terms] => Array
(
[0] => cursos-de-atualizacao
)
[field] => slug
)
)
[primary_table] => am_4_posts
[primary_id_column] => ID
)
)
How can I get the query out of the WP_Tax_Query object? If I go down to queries like so: $wp_query->tax_query->queries[0]
, I still doesn't work.
I believe it might work if get the array in queries
property and merge one layer above at tax_query
. However I don't want to do this manually if there may be any already built-in way (which I seem not to be able to find anywhere).
本文标签: wp queryHow can I use wpquerygttaxquery as taxquery parameter for a new WPQuery instatiation
版权声明:本文标题:wp query - How can I use $wp_query->tax_query as tax_query parameter for a new WP_Query instatiation? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745654443a2161513.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论