Query component

The Query component includes the following:

  • WP_Query, WP_User_Query, and WP_Comment_Query. These are the three APIs that WordPress offers for constructing complex data queries.
  • Template functions used to deterimine the kind of page currently being requested. These are the is_*() functions – is_month(), is_single(), and so on.
  • WP_Meta_Query, WP_Tax_Query, and WP_Date_Query. These are helper classes, used by the main query classes as well as third-party plugins, to construct SQL clauses related to metadata, taxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. terms, and date ranges.

Projects for future releases

  • Improved caching. Most queries are currently cached at the level of individual items (posts, users, etc), but the IDs that result from the query are uncached. See #22176 for an example.
  • The query classes, and particularly WP_Query, contain lots of legacy code that causes problems in edge cases, makes unit testing difficult, and so on. There are various initiatives underway to clean up some of these problems. See #30911 for an example related to post_status.

 

Recent posts on the make/coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. blogblog (versus network, site)

View all posts tagged query.

216 open tickets in the Query component

216 open tickets defect (bug) enhancement feature request
26 33 2
5.8 3 4 0
Awaiting Review 74 27 8
Future Release 21 16 2

216 open tickets. Last 7 days: +0 tickets

49 tickets that have no replies

View list on Trac

  • #30994  Offset return for wp_get_archives
  • #36309  Timezone issue in WP_Date_Query->build_mysql_datetime
  • #36670  Move CAST to right-hand side of comparison in metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. query
  • #36907  Improved sticky post query performance
  • #36966  Search is not working with soft hyphen symbols
  • #37489  If Posts have the same datetime, the order of the post is indefinite.
  • #39428  Die fast in get_posts if get_user_by returns false
  • #39632  Adding Query identifier attribute ui
  • #39914  'orderby' date results differs depend on 'post_status'
  • #40300  `title` parameter causes `WP_Query` to return sticky posts.
  • #40327  Wrong SQL request for 'EXIST' OR 'NOT EXIST' on same post meta
  • #40341  Make search possible in custom fields
  • #40404  Slow queries with a large number of posts (tens of thousands and above) performance
  • #40903  Filtered posts_request query can break found_posts query
  • #40984  Possible Bug with Named Orderby Meta Query SQL
  • #41678  Make sure all field returns use filters in WP Query performance
  • #41700  New filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. return in WP_Query performance
  • #41843  Provide more flexibility to the `get_{$adjacent}_post_where` hook
  • #42082  Support compare custom fields in WP_Meta_Query
  • #42732  Problem with usage of WP_Term_Query inside WP_Tax_Query
  • #43324  query_vars is not necessarely representative of the final query_vars used to build the SQL query
  • #43445  Wildcard `LIKE` support for `WP_Meta_Query` (and maybe other queries?)
  • #43634  WP_Query returns wrong result if 10+ search terms and all negative.
  • #43842  get_children() function enhancementenhancement Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature..
  • #44372  WP_Query cannot properly order by nested Parent/Child relationships
  • #44519  Where are the pages of the headings added with the + add-on (any) ala https://wp-kama.ru/cat/wordpress/codex+xxx
  • #44602  meta_query to support FIND_IN_SET
  • #44964  `redirect_guess_404_permalink` doesn't support array in `post_type` var
  • #45376  Search not working as described in codex
  • #45400  last of query_vars contains anchor
  • #46285  Search colums of WP User Query vars is not updated after applying user_search_columns filter
  • #46347  WP_Term_Query where sql_clauses oddity
  • #47009  WP_Query bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. with author=0
  • #47211  using amp in search show all post / pages with the &
  • #47493  Meta Query Sorting with relation => OR not behaving as expected
  • #47694  Adding a filter for $searchand variable
  • #48020  Queries display in inconsistent order when ordering by meta_value_num
  • #48029  WP_Query::query only using a single post_status
  • #48768  WordPress 5.3 ajax bug with Elementor 2.7.5 javascriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/.
  • #49057  Add tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.) for any WP_Query for simple access in pre_get_post action
  • #49168  is_post_type_archive( $post_types = '' ) doesn't work with underscore (_) template
  • #49284  WP_Meta_Query's 'compare_key' does not support 'NOT EXISTS' when used with WP_User_Query
  • #49550  is_home is set to true even for cron jobs, which causes sticky posts to get prepended to all WP_Query results
  • #49555  Reorder WP_Query methods for a more logical placement
  • #49911  WP_Tax_Query generates incorrect SQL
  • #50598  Replace developer.w.org instead of Codex on is_main_query function message
  • #51794  An author_name query with nonexistent user returns posts with no author
  • #52386  Should WP_Query::get_posts be a private method? performance
  • #52971  WP_Query's meta_query With Multiple EXISTS keys and OR Relation Doesn't Work Properly

7 tickets slated for 5.8

View list in Trac

  • #17019  add hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same. for Media Library attachment counts
  • #17025  wp_list_authors() is not filterable
  • #17737  Be better at forcing data types for query vars
  • #29660  Functions in wp_includes/query.php assume non-null return value from get_queried_object
  • #41266  Not hard coding the table alias prefix in WP_Meta_Query would make class more extendable
  • #49278  Improve meta query performance
  • #52252  PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher Notice when `monthnum` query var is set without the `year` QV

216 open tickets

Open enhancements: 80 View list on Trac
Open tasks: 0 View list on Trac
Open feature requests: 12 View list on Trac

Help maintain this component

Component maintainers:

Many contributors help maintain one or more components. These maintainers are vital to keeping WordPress development running as smoothly as possible. They triagetriage The act of evaluating and sorting bug reports, in order to decide priority, severity, and other factors. new tickets, look after existing ones, spearhead or mentor tasks, pitch new ideas, curate roadmaps, and provide feedback to other contributors. Longtime maintainers with a deep understanding of particular areas of core are always seeking to mentor others to impart their knowledge.

Want to help? Start following this component! Adjust your notifications here. Feel free to dig into any ticketticket Created for both bug reports and feature development on the bug tracker..

Contributors following this component: