Contents
Submit a Question - Plugixa FAQ
POST /plugixa-faq/v1/frontend/submit-faq
Store a question sent by a visitor as a new FAQ awaiting moderation.
Public: no authentication. It needs FAQ submission on in the settings. Needs Plugixa FAQ Pro: the free build does not register this route, so it answers 404 there.
Note. A submission is never published: it is stored as
draftorpending(the Default status setting), withsourceset toform. Nothing limits how often one visitor can submit. Turn on Cloudflare Turnstile for the form if it is public: see Spam protection.
Request
POST https://your-site.example/wp-json/plugixa-faq/v1/frontend/submit-faq
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
question |
string |
See below | The question. Plain text. |
answer |
string |
No | A suggested answer. HTML allowed in a WordPress post is kept. |
submitter_name |
string |
See below | Saved as the FAQ’s author_alias. |
submitter_email |
string |
See below | Saved as submitter_email. Must be a valid address when sent. |
category_id |
integer |
No | A category. An id that does not exist is dropped. |
custom_fields |
object |
No | Custom field values keyed by field key. Empty values are skipped. |
turnstile_token |
string |
No | Required when Turnstile is on for the submission form. |
The body must be JSON: form-encoded fields are not read. Which fields are required comes from the Required fields setting, by default question, submitter_name and submitter_email. With WPML or Polylang active the FAQ gets the current language. When Notify admin is on, the site’s admin address gets an e-mail with a link to the FAQ. See Submission form.
{
"question": "Do you ship to Canada?",
"submitter_name": "Alex Martin",
"submitter_email": "alex@example.com",
"category_id": 3
}
Responses
200 OK. data.faq_id is the stored FAQ.
{
"success": true,
"message": "Thank you! Your FAQ has been submitted for review.",
"data": {
"faq_id": 57
}
}
| Field | Type | Meaning |
|---|---|---|
data.faq_id |
integer |
The new FAQ, for moderators |
message |
string |
The success message from the settings |
Errors
| Status | Code | When |
|---|---|---|
403 |
rest_forbidden |
Submission is off in the settings, or the plugixa_faq_submission_permission filter refused. |
400 |
rest_error |
“The field “question” is required.” (or another required field), or “Please enter a valid email address.” |
403 |
rest_error |
“Spam protection check failed”: the Turnstile token is missing or invalid. |
500 |
rest_error |
The database refused the row. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/frontend/submit-faq" \
-H "Content-Type: application/json" \
-d '{"question":"Do you ship to Canada?","submitter_name":"Alex Martin","submitter_email":"alex@example.com","category_id":3}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/frontend/submit-faq');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'question' => 'Do you ship to Canada?',
'submitter_name' => 'Alex Martin',
'submitter_email' => 'alex@example.com',
'category_id' => 3,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/frontend/submit-faq', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ question: 'Do you ship to Canada?', submitter_name: 'Alex Martin', submitter_email: 'alex@example.com', category_id: 3 }),
});
const { data } = await response.json();
Quick Links
Share