Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
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

Description

@danielbachhuber

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.

Activity

  1. added this to the 2.0 milestone on Oct 23, 2015
  2. joehoyle commented on Oct 27, 2015

    @joehoyle
    Member

    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions