node-wpapi
node-wpapi copied to clipboard
create post's taxonomies by slug not ID
Is it possible to create post's taxonomies by slug not ID.
Like this:
wp.school().create({
title: 'title',
state: ['ca', 'az']
})
Not this way:
wp.school().create({
title: 'title',
state: [22, 23]
})
@kauaicreative I don't think you can do what you are asking in a single request, however you can use the term slug to find the term ID and then pass it into the create request.
Check out this section of the README which explains the usage of .slug()
:
To find the ID of a tag or category for which the slug is known, you can query the associated collection with .slug() and use the ID of the returned object in a two-step process...