Skip to content

Instantly share code, notes, and snippets.

View emirhangumus's full-sized avatar
🎯
Focusing

Emirhan Gümüş emirhangumus

🎯
Focusing
View GitHub Profile
@ahmadawais
ahmadawais / upload-a-file.MD
Created June 18, 2017 11:07 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle: