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.

273 open tickets in the Query component

273 open tickets defect (bug) enhancement feature request
23 30 2
6.9 2 0 0
Awaiting Review 117 36 12
Future Release 29 19 3

273 open tickets. Last 7 days: +0 tickets

65 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
  • #36966 Ā Search is not working with soft hyphen symbols
  • #37489 Ā If Posts have the same datetime, the order of the post is indefinite.
  • #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
  • #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
  • #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 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.
  • #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
  • #49555 Ā Reorder WP_Query methods for a more logical placement
  • #49911 Ā WP_Tax_Query generates incorrect SQL
  • #51794 Ā An author_name query with nonexistent user returns posts with no author
  • #52971 Ā WP_Query's meta_query With Multiple EXISTS keys and OR Relation Doesn't Work Properly
  • #53495 Ā incorrect (and confusing) DocBlockdocblock (phpdoc, xref, inline docs) for get_page_by_title() docs
  • #54268 Ā Using `author_name` in URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org parameter gives unexpected results when logged into contributor account administration
  • #54436 Ā Sorting issue- when sorting via a custom meta key
  • #55649 Ā BlockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. Query with full post content do not display properly
  • #55748 Ā wp_query post_type taxonomies doesn't accept array in url if hierarchical
  • #56081 Ā Query LoopLoop The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. https://codex.wordpress.org/The_Loop. block with selection causes Sticky Posts setting to be ignored
  • #56168 Ā Add a way easily perform advanced post fields queries
  • #57303 Ā wp_get_posts() for post_type="any" + post__in creates not optimized database query performance
  • #57412 Ā Uncaught TypeError: Cannot read properties of undefined (reading 'length'): jquery migrate
  • #57505 Ā categoryCategory The 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. archive url ending with "/0" should be 404
  • #57766 Ā filter query_loop_block_query_vars repeater 4 times
  • #58447 Ā Posts with ā€˜Stick to the top of the blog’ should also stick to the top of the categories it belongs to
  • #58553 Ā Two query blocks on home template (FSE) breaks the second one
  • #58806 Ā Unexpected ordering result when ordering based on multiple clauses
  • #60027 Ā Post patterns show no posts
  • #60154 Ā Add filter hook to either get_post_stati or WP_List_Util::filter
  • #60274 Ā Query loop showing too many posts
  • #60468 Ā WP_Query matches any post when query parameter "name" is an empty string
  • #60490 Ā Add 'author__in' option to WP_Query 'orderby' options
  • #60963 Ā Custom query, inherit main query, show scheduled posts
  • #60984 Ā WP_Query is returning the two same post instead of one
  • #61008 Ā Allow searching of extra post fields
  • #61621 Ā WP_Query get_posts should be call its property not again execute all caculations
  • #63094 Ā Allow ordering by meta_id in a meta query
  • #63106 Ā The loop can throw warning if `WP_Query::have_posts()` not called.

2 tickets slated for 6.9

View list in Trac

  • #35913 Ā `is_()` conditional methods should share their logic
  • #47719 Ā Consistency issue with `include` parameter set to "0" in `WP_Term_Query`

273 open tickets

Open enhancements: 85 View list on Trac
Open tasks: 0 View list on Trac
Open feature requests: 17 View list on Trac
Open defects: 171 View list on Trac

Help maintain this component

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: