Editing Terms & Term Meta with the WordPress REST API

Here are some JavaScript snippets to manipulate WP_Term objects in WordPress using the REST API and the Backbone JavaScript client library.

Insert a term

Delete a term

This next example assumes you’ve used wp_localize_script() to make the REST API endpoint and a nonce available in an object myplugin. If you need help doing this, please leave a comment below and I’ll expand this example.

Edit a term meta value

Let’s add a term meta value to identify the number of speeds in this automatic transmission.

Thanks for reading. If you know a better way to edit terms and term meta in JavaScript, please leave a comment below.

Leave a comment

Your email address will not be published. Required fields are marked *