How to Add Meta Fields when Creating a Post with REST API
This tutorial is a small addition to my another tutorial about creating posts with REST API in WordPress, because there I didn’t mention how to work with metadata and what moments you have to keep in mind.
As a result of this tutorial we will just create a simple draft post with a couple custom fields in it.
Upload Featured Image to a Post with REST API
Recently I have updated the tutorial about creating a post with WordPress REST API but I didn’t cover a topic of featured images there.
It is not that simple actually, but I will make it simple for you.
Code Snippets Tutorial (Where to Insert the Code)
I have a plenty of code tutorials on my blog but almost in none of them I describe in details where to insert the code in WordPress. It is because I write mostly for developers who already know something so I usually skip the basic part.
But I came to a decision that it would be super-useful to have a tutorial like this on my blog.
So here we are – right now I am going to show you 3 ways how you can use code snippets on your WordPress or WooCommerce website.
Remove Post Type Slug from URLs
I’ve been asked about how to do it probably a million times. The question is how to make the URLs of your custom post types (or WooCommerce products) to look like Pages.
For example how to have example.com/t-shirt/
instead of example.com/product/t-shirt/
.
In this tutorial I am going to provide you a complete guide! As an example we are going to remove /product/ from WooCommerce product URLs. But before we begin I would like to warn you that you have to avoid it if possible, because it may slows down the overall performance of your website and you have to be extra-careful when assigning a specific slug for your posts.
Add Custom Fields to User Profiles
In this tutorial I am going to show two methods how you can add additional user profile fields in WordPress admin area. In the first one we are not going to use any plugins at all, in the second one – we will do the same, but with the help of my Simple Fields plugin.
Let’s get started, I think. Here is what we are going to create:

Add Custom Fields to Comments
I already have plenty of tutorials about working with custom fields – a tutorial about creating custom meta boxes for posts, a tutorial about custom taxonomy term fields, a tutorial about options pages and even my own Simple Fields plugin intended to simplify the work with all that stuff. Now it is time to talk about meta boxes for comments.
The long story short let me show you what we are going to create:

It is not a very difficult meta box, but I am just going to show you the process how it works, everything else is up to you. We are going to do it without any plugins first.
Sanitize Early, Escape Late, Always Validate
If you’re working with WordPress for a while, I am sure you’ve heard about such words like “sanitizing” or “escaping” or at least have seen in the code sanitize_text_field()
, esc_html()
or similar functions.
This tutorial is intended to sort this whole data validation thing out once and forever.