[wp-trac] [WordPress Trac] #43757: `WP_REST_Attachments_Controller` includes entire admin includes for a few utility functions

WordPress Trac noreply at wordpress.org
Fri Apr 13 10:33:15 UTC 2018


#43757: `WP_REST_Attachments_Controller` includes entire admin includes for a few
utility functions
------------------------------+-----------------------------
 Reporter:  lonelyvegan       |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  REST API          |    Version:  trunk
 Severity:  minor             |   Keywords:  needs-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 Looks like https://core.trac.wordpress.org/browser/trunk/src/wp-includes
 /rest-api/endpoints/class-wp-rest-attachments-controller.php uses only a
 few admin function (`wp_handle_upload`, `wp_generate_attachment_metadata`,
 `wp_tempnam`, and `wp_handle_sideload`) but it's requiring the entire
 `admin.php` include.

 It seems we could just require `file.php` and `image.php` from the admin
 directly instead.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43757>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list