Opened 7 years ago
Closed 7 years ago
#36874 closed feature request (duplicate)
Depreciation of query_posts()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.2 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
query_posts()
alters/breaks the main query, and if not properly reset, leads to many issues with other functions and code. Just how bad query_posts()
really is, one can check this complete post on WPSE.
It is widely accepted, and also recommended to use pre_get_posts
to alter the main query and WP_Query
or get_posts
to run secondary queries.
query_posts()
can therefor be depreciated in favor of any of the above mentioned actin/class/function as query_posts
should never be used to run any type of query due to the fact that it breaks the main query and also reruns queries which makes slow pages down.
Can we depreciate query_posts()
with the proper debug message that one should rather use any of the above mentioned methods to alter the main query or to run secondary queries
Duplicate of #19631.