[wp-trac] [WordPress Trac] #40343: REST API - set attachment upload directory on request

WordPress Trac noreply at wordpress.org
Mon Apr 3 00:59:27 UTC 2017


#40343: REST API - set attachment upload directory on request
-------------------------+-----------------------------
 Reporter:  curdin       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:  rest-api     |
-------------------------+-----------------------------
 When using the Rest API to migrate content from a third-party system to
 WordPress it is useful to be able to specify the upload directory for
 systems that have month/day upload structures enabled. This can prevent a
 larger legacy system from dumping a large amount of files into the upload
 directory for the current month.

 In my use case I would have ended up with 200'000+ files in the 2017/03
 directory.

 I propose adding another header to the /media endpoint that can be used to
 set the upload directory via a YYYY/MM date. This can then be passed to
 the `wp_handle_sideload` function.

 I have attached a proof of concept, which likely needs validation

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


More information about the wp-trac mailing list