Search code examples
wordpresswordpress-rest-api

wordpress rest api v2 get terms table


I am using wordpress 5.7 and it's rest api v2. I want to get the rows of the terms table.

I tried all the api endpoint, but can't find the api to query the rows of terms table.

how can I get the rows of terms table, just as the following sql statement:

select * from {table_prefix}_terms;

Solution

  • In the terms table Wordpress stores all the terms like category and tag, plus your custom taxonomies. You cannot get all terms in one blow. You can, however, use the endpoints for category and tag to get all the terms.

    https://example.com/wp-json/wp/v2/categories
    https://example.com/wp-json/wp/v2/tags