admin管理员组文章数量:1201361
Is it possible to add WP_Query arguments from functions.php to any of wp_query running on current page? For example, I want to add $args['order'] to current running wp_query on any pages.
Is it possible to add WP_Query arguments from functions.php to any of wp_query running on current page? For example, I want to add $args['order'] to current running wp_query on any pages.
Share Improve this question asked May 22, 2022 at 12:09 Manish ShahManish Shah 32 bronze badges1 Answer
Reset to default 1Use a pre_get_posts
hook to modify the relevant query variables, with conditional tags to target specific pages/queries (and probably return from the callback early on is_admin()
so you do not affect dashboard queries).
本文标签: wp queryHow to add args to any running wpquery from functionphp
版权声明:本文标题:wp query - How to add $args to any running wp_query from function.php? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738577112a2100942.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论