Make WordPress Core

Opened 8 years ago

Last modified 11 days ago

#39703 new enhancement

wp-signup.php & wp-activate.php are doing an avoidable posts query

Reported by: imath's profile imath Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: has-patch 2nd-opinion
Focuses: multisite, performance Cc:

Description

Hi,

If in the reading settings of the site, i chose to list my latest posts as the home page: going on wp-signup.php or wp-activate.php will query & fetch the 10 latests posts for nothing in a way. Moreover In this case is_home() is true which is a bit confusing.

If in the reading settings of the site, i chose a static front page as the home page, it will be requested and fetched when going on wp-signup.php or wp-activate.php. In this case is_page() is true which is less confusing.

So i guess, the particularity of these two specific pages is they're getting the header and the footer of the active theme.

But i wonder why running wp() ?

By simply directly loading the wp-includes/template-loader.php it can save a query.

see signup-activate-1.patch

If running wp() is required for a reason i don't see, a query could still be saved and it could be interested to use this to set a "page" title for the <title> tag.

see signup-activate-2.patch

Attachments (4)

signup-activate-1.patch (1.4 KB) - added by imath 8 years ago.
signup-activate-2.patch (4.9 KB) - added by imath 8 years ago.
39703.1.patch (1.1 KB) - added by sabernhardt 2 years ago.
39703.2.patch (4.8 KB) - added by sabernhardt 2 years ago.

Download all attachments as: .zip

Change History (15)

#1 @johnjamesjacoby
8 years ago

This is interesting. Good find.

I can't think of a problem with this, other than someone doing something weird that would still require the $wp_did_header check.

#2 @imath
7 years ago

  • Keywords has-patch added

#3 @swissspidy
7 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted

@sabernhardt
2 years ago

@sabernhardt
2 years ago

#4 @sabernhardt
2 years ago

I refreshed the patches for both options. I like having a special title for each page (option 2).

#5 @poena
5 months ago

  • Keywords needs-testing-info added
  • Milestone changed from Future Release to 6.6

This ticket was mentioned in Slack in #core by oglekler. View the logs.


7 weeks ago

#7 @oglekler
7 weeks ago

  • Focuses performance added
  • Keywords early added
  • Milestone changed from 6.6 to 6.7
  • Type changed from defect (bug) to enhancement

This ticket was discussed during bug scrub.

Due to impact on the WP_Query class, it was decided to make it an early ticket plus this is a performance enhancement and not a bug, so, I am adjusting status, keywords and type.

Add props to @hellofromTonya

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.


6 weeks ago

#9 @rajinsharwar
4 weeks ago

  • Keywords 2nd-opinion added; needs-testing-info early removed

Well, if we just simply require the template-loader.php, instead of wp-blog-header.php, it solves the issue of those unnecessary queries. But, I am afraid this will break some plugin functionalities, for example in this case Query Monitor. The Query Monitor's debug bar doesn't show there if we do not call the wp() function.

I want to propose a different approach. Why don't we modify the parse_request() method or the main() method in WP class to not run any WP QUERY in the query args is empty?

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.


11 days ago

#11 @mukesh27
11 days ago

  • Milestone changed from 6.7 to Future Release

Hi there!

Upon first review, it seems this needs next steps for path forward. I will move it to a future release for now. If anyone feels comfortable, we can move it back to the milestone.

Note: See TracTickets for help on using tickets.