sensei
sensei copied to clipboard
Stop calling wp() during initialization
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 theinithook).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.