The WordPress block editor (a.k.a. Gutenberg) communicates with the database via the WordPress REST API. We can read and write post meta from within the Gutenberg editor after we enable the specific post meta field in the WordPress REST API.
WordPress
Add WordPress Posts Column
Code to add a custom column to the WP Admin Posts listing page.
Why __() needs a hardcoded string in WordPress
When using a WordPress translation function, e.g. __(), you need to use a hardcoded string (not a variable).
Add Gutenberg JavaScript Filter
WordPress PHP filters allow you make a value modifiable from outside of your code. With the WordPress Block Editor (a.k.a. Gutenberg), you can now do the same thing in JavaScript.
Check WP_DEBUG
Recently I was talking to another developer about how to detect ‘WP_DEBUG’ being set on a WordPress installation. Here is the code I use.
WordPress Gutenberg import versus Destructuring Global wp
When creating a block for the WordPress block editor (a.k.a. Gutenberg), you are often using existing components. WordPress makes these components available under the global JavaScript variable ‘wp’ as well as available as npm packages. Which is the better way to make a component available in your code?
WordPress Gutenberg Functional Component useState
When creating a block for the WordPress block editor (a.k.a. Gutenberg), I find that most of the documentation is for class components. However, with React hooks we can use functional components. When you need to import ‘useState’ from React, you can do it as follows in a WordPress block.
WordPress and SQL Injection
An SQL injection vulnerability occurs when you use a variable in your SQL statement and someone uses the variable to add unexpected code. In this article, we’ll look at how this occurs and how to prevent it.
WordPress REST API call to Update Post Status Fails Silently
Recently, I was trying to update the post status of a post from ‘future’ to ‘publish’ publish` with the WordPress REST API and while the submission appeared to work, the value was not modified.
Test WordPress REST API Endpoints from the Browser with jQuery
You can make WordPress REST API calls from the browser console. Here is one way I work with WordPress REST API endpoints in the browser using jQuery.