You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Figure out how to make admin functions available to endpoints as they need them #1686
In #1682, we had to start loading all admin APIs when the plugin is loaded because some of our endpoints are dependent on admin functions.
Because the API is intended to be able to replicate the WordPress admin (e.g. #323), we will need to figure a long-term solution for loading admin functions as endpoints need them.
Areas where we current need the admin functions loaded:
Anything using page templates
Anything using wp_generate_attachment_metadata (e.g. media endpoints)
Use of get_editable_roles in the users controller
Currently the Core unit tests library loads admin.php which is why we didn't catch any of the breakage in unit tests (see https://core.trac.wordpress.org/browser/trunk/tests/phpunit/includes/testcase-xmlrpc.php). I'm not sure of the Core stance on what is loaded, as it's a monolithic test suite run testing everything, they don't load typically any different contexts, presumably meaning fatals can sneak through.
I don't think Core is likely to change that, as they'd need to run a bunch of different contexts. Instead, we should probably require files in the REST API as we need them (e.g. for wp_generate_attachment_metadata)
In #1682, we had to start loading all admin APIs when the plugin is loaded because some of our endpoints are dependent on admin functions.
Because the API is intended to be able to replicate the WordPress admin (e.g. #323), we will need to figure a long-term solution for loading admin functions as endpoints need them.