sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Stop calling wp() during initialization

Open gikaragia opened this issue 3 years ago • 0 comments

Overview

In Sensei initialization we call wp() in order to be able to parse the incoming request and check if the learn string is contained in the URL in order to load our course theme. This is dangerous for two reasons:

  • wp() is a very basic WP function that executes various hooks which other plugins can rely on. This can break other plugins as in general it might be expected to be executed only once and within a specific order (e.g. it can be expected that wp() is always executed after the init hook).
  • wp() executes a lot of WP initialization code which we now execute twice and leads to a performance penalty.

This has been reported as part of this issue.

Proposed solution

Ideally, we should look into parsing the request without executing any hooks that might break other plugins. This might be done if we use WP::parse_request.

gikaragia avatar Jun 22 '22 08:06 gikaragia