This week, I finally have a new release for you! Version 0.5 is now available, with the following changes (and more!):
- Add support for media – This has been a long time coming, and it’s finally at a point where I’m happy to push it out. Good luck. (#272)
- Separate the post-related endpoints – Post-related endpoints are now located in the
WP_JSON_Posts class. When implementing custom post type WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept. support, it’s recommended to subclass this.
The various types are now also only registered via hooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same., rather than directly in the server class, which should make it easier to override them as well (#348)
- Add page support – This is a good base if you’re looking to create your own custom post type support (#271)
- Switch from fields to context – Rather than passing in a list of fields that you want, you can now pass in a context (usually
- Use better error codes for disabled features (#338)
X-WP-TotalPages headers for information on post/pagination counts (#266)
As always, the full changes are available if you’re interested.
This week finally brings media into the fold. The process for uploading media is a little different to creating normal posts, so here’s how you do it.
First, upload the file via a POST request to
/media. This can either be as a standard HTTP multipart body, with the name field set to
file, or as a raw file in the body with the
Content-Type header The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes.. (You can also optionally send a
Content-MD5 header if you’d like the server to check the consistency of your file.) This will give you a 201 Created status, and point you to the new resource. You can now update that resource with the correct post data.
This multistep procedure is required to enable raw file uploads, and I’m not entirely pleased with it, but it’s the only way without requiring multipart requests. I’d love to have feedback on this system, as I think practical use will eventually reveal the correct method here.
So, it’s time to start winding up the Summer of Code portion of the project. There’s still one week left for the Summer of Code project, so you may still see a release next week, but most likely in the form of smaller updates, especially with documentation and testing. As I finish up, it’s time to look forward to the future of the project. The plan is to form a Feature as a Plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party team as we work towards core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. integration in future releases. People have already volunteered for the team back in the 3.8 scoping days, and I’ll be getting in contact with them shortly, but it’s not too late to nominate yourself for the team; let me know if you’re interested.
Thanks to everyone for testing and for your feedback. Stay beautiful.