Developers are used to keeping tabs on rapidly evolving technologies. Learning about new WordPress updates was not something that could stir up the still waters in the WordPress world, but with the WordPress 5.0 update things have changed.
Since the very date it was announced, it inspired the WordPress community to become more than active. The main questions that arise are: “What is so special about WP 5.0 update?”, and “Are there any specific tips for the developers?” Well, guess what? We’ve done our research. Here is what we found about the WordPress 5.0 update compared to WordPress 4.9, that developers may find particularly interesting.
WordPress Rest API Improvements
To make WordPress more competitive in the world of CMS platforms, the developers delivered the WordPress Rest API and it became fully integrated starting with the WordPress 4.7 version.
So what’s new in the REST API 5.0? Developers have added new endpoints that were absent in WordPress 4.9. This is all done because of the new block-based editor introduced in the 5.0 version. We will come back to this editor a little bit later.
The new endpoint is “Autosaves”. This endpoint is registered for all post types, including custom post types. The post type attachment is the only one that remains unregistered. This is a smart move because all post types must be able to autosave, regardless of whether revisions are enabled. This endpoint returns preview_link, an action triggered by the Post Preview button in the new editor.
The next new endpoint is “Search”. Developers have made searching through all post types easier now. They added a new class – WP_REST_Post_Search_Handler. The new endpoint is registered as /wp/v2/search. The new editor’s link inserter uses this endpoint.
Then we have a new hidden post type – “wp_bock”. This endpoint enables users to save reusable blocks in the new editor. The reusable blocks can be found in wp/v2/blocks. On the other hand, dynamic blocks rendered on the server side, such as archives and comments, can be retrieved from wp/v2/block-renderer/<name>.
The new editor now checks which features the newly installed theme has, via the wp/v2/themes endpoint. If the theme comes with features not supported by the Gutenberg, they will remain hidden from the user. For more details, check out the official dev notes.
The Brand New Gutenberg WordPress Editor
In WordPress 4 vs 5 the pattern is very obvious here – all the new changes in the REST API are made to support this new editor, named Gutenberg.
What is Gutenberg
Unless you were living under a rock for the past few years, you’ve probably already heard about Gutenberg. But what you probably heard was that Gutenberg is a new WordPress editor. While it is technically the new editor, it is so much more than that. The introduction of Gutenberg is the first out of three stages of WordPress 5 future development. The second stage is the introduction of page templates, and the third is WordPress becoming an easy-to-use site customizer. This is great news for people who want to use WP just to start a blog.
Gutenberg is a brand new block editor that arrived with the latest WordPress update 5.0. If you install the newest WordPress, you will notice some changes when you enter the WordPress editor. Yes, everything is gone. The less tech-savvy users can do everything more easily now.
But developers can do so as well. Right beside the cog-wheel icon on the right side of the screen, there is the “three dots” icon. If you click it, you can switch to code editor to further customize the blocks and how the post will look like.
Since Gutenberg is all about the blocks, you should know that there are blocks for all sorts of things: paragraphs, lists, code, images, headings, and so on. Every block you add will have its own settings and layout, and each block you create and fine-tune can be saved as a reusable block and used again in a new post.
For instance, once you get a logo for your website, you can create a logo block and reuse it on every page.
How to Get Ready
Getting ready for a WordPress 5.0 as a developer is not as hard as you’ve probably imagined.
It’s Time for a Backup
The golden Backup rule also applies here. Before you update your WordPress to the newest version, make sure to backup all the websites you are maintaining. This will help you to roll back if you can’t fix any of the post-update bugs.
Take a Deep Dive into React
The next step on your road to getting ready for WordPress 5.0 is taking a deep dive into React. Why? Because Gutenberg is an interface built on Javascript. WP developers have used React – Facebook’s open-source UI library. If you need to create a completely new type of block, you will have to use JavaScript. Some devs have figured out a way to create custom blocks with PHP, though.
Your main point of interest if you want to create complex blocks and share components with other apps built on React should be learning all about the React library and how to use it.
Stay Tuned to the WordPress Community
The WordPress dev community is huge. We suggest that you stay tuned to the latest developments. There are already dozens of contributions you can use as learning material for free. Feel free to check out this amazing dev-talks about WP Gutenberg article and similar resources. The dev-toolbox create-guten-block is also worth checking out. It will enable you to develop Gutenberg blocks very efficiently and without doing anything to React or JS.
Read About the New Plugins
And lastly, before you make a complete switch to WordPress 5.0, make sure to check the plugin compatibility on the websites you are maintaining. If you want to learn more about making your plugins Gutenberg-ready, there’s a useful step-by-step guide you can check out.
This covers the WordPress 5.0 essentials from the developer’s point of view. If you want to learn more about it, feel free to continue your search online. The WordPress dev community is restless, and you will be able to find a lot of useful resources.