Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#34395 closed defect (bug) (fixed)

Don't load admin files on each request

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

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 6 years ago.

Download all attachments as: .zip

Change History (4)

@swissspidy
6 years ago

#1 @swissspidy
6 years ago

  • Keywords has-patch dev-feedback added
  • Milestone changed from Awaiting Review to 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.


6 years ago

#3 @wonderboymusic
6 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to 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.