Hi,
Please check out this link which will give you some idea of how to create the category http://v2.wp-api.org/reference/categories/ once you create the category want to assign that category to post then update post api will help
http://v2.wp-api.org/reference/posts/
Hope it helps.
Thanks,
Vignesh Pichamani.
Primary category? Unless you mean default category, there is no such designation in WP core, it must be a plugin or theme feature. There is no core get_primary_category() function AFAIK. Unless the module adding this feature has provided a REST API endpoint for this, a custom endpoint is probably needed unless the status can be determined through term meta or something.
Thread Starter
emadil
(@emadil)
Yes my question is about Yoast Plugin
https://joshuawinn.com/using-yoasts-primary-category-in-wordpress-theme/
do you know a php function to set a primary category?
Thank you
I’m sure there’s a way, but I don’t know what it would be. Knowledge of the inner workings of Yoast would be required to figure out a way. I suggest you ask in the dedicated support forum where those with the requisite knowledge can address your question.
Whatever PHP process does this can be implemented as a custom API endpoint. Yoast support should be able to tell you if an endpoint already exists or if you need to create one.