WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36874 closed feature request (duplicate)

Depreciation of query_posts()

Reported by: pietergoosen 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

Change History (1)

#1 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #19631.

Note: See TracTickets for help on using tickets.