I have two custom taxonomies that I use for my posts.
I am trying to retrieve the names from only one of them.
In REST API V2, I do the following:
https://example.com/wp-json/wp/v2/posts/14340/?_embed=wp:term
This embeds the actual names for ALL taxonomies (Categories plus my two custom ones) but I am only interested in the names associated with each post only for one of the custom taxonomies.
Example response:
"_embedded": {
"wp:term": [
[
{
"id": 2272,
"link": "https://example.com/category/cat1/",
"name": "Cat1",
"slug": "cat1",
"taxonomy": "category",
"_links": {
....
}
}
],
[],
[
{
"id": 1740,
"link": "https://example.com/custom1/custom-name/",
"name": "Custom Name",
"slug": "custom-name",
"taxonomy": "custom-tax-1",
"_links": {
....
}
}
],
[
{
"id": 2148,
"link": "https://example.com/custom2/custom-name-1/",
"name": "Custom Name 1",
"slug": "custom-name-1",
"taxonomy": "custom-tax-2",
"_links": {
....
}
},
{
"id": 2150,
"link": "https://example.com/custom2/custom-name-2/",
"name": "Custom Name 2",
"slug": "custom-name-2",
"taxonomy": "custom-tax-2",
"_links": {
....
}
}
]
]
}
So I get back these taxonomies:
- category (1 item)
- custom-tax-1 (1 item)
- custom-tax-2 (2 items)
How can I make it so it only returns values for custom-tax-2?