How to place custom post type or taxonomy template files in a custom directory
How to place custom post type or taxonomy template files in a custom directory

When developing your own plugin or addon, due to some technical requirements, WordPress template files sometimes need to be placed inside the plugin directory (i.e., not in the theme folder). What is needed for this?

As an example, take the WooCommerce or bbPress plugin. By default, plugin templates are stored inside the plugin folder. For Woo, it’s “/wp-content/plugins/woocommerce/templates”, and for bbPress — “/wp-content/plugins/bbpress/templates/default/bbpress”. This article describes how to partially implement similar functionality, but in a simplified form (we’ll cover full implementation in upcoming posts).

read more...

How to Get, Create, Edit, or Delete Metadata in WordPress via REST API
How to Get, Create, Edit, or Delete Metadata in WordPress via REST API

Today we’ll take a look at another useful feature — how to work with post or term meta data via the API. Just like with creating data via the API, WordPress by default doesn’t support meta field interaction. To enable it, we’ll need to install a third-party plugin. Unfortunately, I couldn’t find it on GitHub — maybe it was moved or merged into the WordPress plugin repository. However, since I still have the plugin archive locally, we’ll use it for this article (you can download the plugin via the provided link). I’m sure you can also find a similar plugin in the WP repository with good reviews.

read more...

How to read, create, edit and delete category and term data in WordPress via REST API
How to read, create, edit and delete category and term data in WordPress via REST API

We continue our series of articles dedicated to the REST WordPress API. Today, we’ll learn how to read, create, update, and delete category and term data (this also applies to custom taxonomies, which we’ll cover later).

Working with terms is almost identical to working with posts, as shown in the previous article. The only differences are the endpoint URL and the parameters used for retrieving, creating, or updating data. read more...

What is the difference between posts_per_page and numberposts in WordPress
What is the difference between posts_per_page and numberposts in WordPress

This post was written both for myself and for anyone who's ever wondered — what's the difference between the “numberposts” and “posts_per_page” parameters passed to the get_posts function?

I sometimes find myself trying to recall the difference, and in various places I use one or the other.

read more...