Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34395 closed defect (bug) (fixed)

Don't load admin files on each request

Reported by: dimadin Owned by: wonderboymusic
Priority: normal Milestone: 4.4
Component: REST API Version: 4.4
Severity: normal Keywords: has-patch dev-feedback
Cc: Focuses: performance

Description

In wp-settings.php, where WordPress is actually started, we load wp-includes/rest-api.php which loads wp-includes/rest-api/class-wp-rest-server.php which loads wp-admin/includes/admin.php which then loads a bunch of admin files and translation.

This is wrong for two reasons:

  • We shouldn't load admin files on each request.
  • It is against #33413.

I don't see why admin files are needed in WP_REST_Server though they might be needed by REST API. In that case, it should be lazy loaded somewhere.

Attachments (1)

34395.diff​ (446 bytes ) - added by swissspidy 11 years ago.

Download all attachments as: .zip

Change History (4)

@swissspidy
11 years ago

#1 @swissspidy
11 years ago

  • Keywords has-patch dev-feedback added
  • Milestone Awaiting Review → 4.4

This was introduced long time ago, back when @rmccue worked on it during GsoC. See ​https://gsoc.trac.wordpress.org/changeset/1980

Seems like it was related to some date handling functions. I ran the core tests and the plugin tests from GitHub now without including wp-admin/includes/admin.php and it worked without a problem. So either it really isn't needed or we just don't know the reason why it's still included.

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


11 years ago

#3 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution → fixed
  • Status new → closed

In 35353:

REST API: don't load wp-admin/includes/admin.php on every request.

Props swissspidy.
Fixes #34395.

Note: See TracTickets for help on using tickets.