Endpoint #
GET /wp-json/rtcl/v1/categories
Authentication #
๐ Required
Permission handled by API Key named x-api-key
Request Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
parent_id | integer | No | ID of parent category to fetch subcategories from |
listing_type | string | No | Filter categories assigned to a specific listing type |
Response #
Returns an array of categories with metadata including name, slug, description, icon, and image URL.
Response Example #
[
{
"term_id": 20,
"name": "Dogs",
"slug": "dogs",
"description": "All about dogs",
"parent": 0,
"count": 15,
"icon": {
"url": "https://example.com/wp-content/uploads/dog-icon.png",
"class": "fas fa-dog"
},
"img_url": "https://example.com/wp-content/uploads/dog-image.jpg"
},
{
"term_id": 21,
"name": "Cats",
"slug": "cats",
"description": "All about cats",
"parent": 0,
"count": 10,
"icon": {
"url": "",
"class": "fas fa-cat"
},
"img_url": ""
}
]
Response Fields #
| Field | Type | Description |
|---|---|---|
term_id | integer | Unique ID of the category |
name | string | Name of the category |
slug | string | Category slug |
description | string | Description text |
parent | integer | Parent category ID |
count | integer | Number of posts in this category |
icon | object | Icon information (optional) |
icon.url | string | URL of the icon image |
icon.class | string | CSS class for icon font |
img_url | string | Featured image for category (optional) |
Notes #
- If no
parent_idis provided, top-level categories are returned. listing_typecan be used to filter categories for specific listing types.- Images and icons are optional; if not set, fields will be empty.
- Results are cached using WordPress transients for 1 week.