Contents
On this page
Get FAQ Tree - Plugixa FAQ
GET /plugixa-faq/v1/faqs/tree
Read every FAQ as a tree of parents and children, in manual order.
Any signed-in user with the plugixa_faq_manage capability or WordPress’s edit_posts (Contributors and up, by default).
Note. The tree is not paged and includes drafts and every visibility. With
category_id, a FAQ whose parent sits in another category appears at the top level.
Request
GET https://your-site.example/wp-json/plugixa-faq/v1/faqs/tree?category_id=3
Query parameters
| Name | Type | Default | Description |
|---|---|---|---|
category_id |
integer |
Only FAQs in this category. |
Responses
200 OK. data.items holds the top-level FAQs.
{
"success": true,
"message": "",
"data": {
"items": [
{
"id": "42",
"question": "How long does shipping take?",
"parent_id": null,
"category_id": "3",
"status": "published",
"menu_order": "0",
"category_name": "Shipping",
"children": [
{
"id": "43",
"question": "Do you ship to islands?",
"parent_id": "42",
"category_id": "3",
"status": "draft",
"menu_order": "1",
"category_name": "Shipping",
"children": []
}
]
}
],
"total": 2
}
}
| Field | Type | Meaning |
|---|---|---|
data.items[].children |
array |
The FAQs nested under this one, same shape, any depth |
data.total |
integer |
All FAQs in the tree, children included |
Errors
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-faq/v1/faqs/tree?category_id=3" \
-u "admin:$WP_APP_PASSWORD"
<?php
$query = http_build_query([
'category_id' => '3',
]);
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/faqs/tree?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const query = new URLSearchParams({ category_id: '3' });
const response = await fetch(`https://your-site.example/wp-json/plugixa-faq/v1/faqs/tree?${query}`, {
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share