Contents
On this page

Create Category - Plugixa Recipe

POST /plugixa-recipe/v1/categories

Create a category.

Needs the plugixa_recipe_edit capability, or WordPress’s edit_posts (Contributor and up).

Request

POST https://your-site.example/wp-json/plugixa-recipe/v1/categories

Request body

Content type: application/json

Field Type Required Description
name string Yes Plain text. Must not be blank.
slug string No Made from the name when empty. Made unique by appending -2, -3, …
description string No Plain text; line breaks are kept.
image_id integer No Attachment id of an image.
display_order integer No Manual position. Default 0.
language_code, translation_group string No For multilingual sites.
{
  "name": "Brunch",
  "description": "Late-morning dishes."
}

Responses

200 OK. data is the new category.

{
  "success": true,
  "message": "",
  "data": {
    "id": "14",
    "language_code": "",
    "translation_group": "",
    "name": "Brunch",
    "slug": "brunch",
    "description": "Late-morning dishes.",
    "image_id": null,
    "display_order": "0",
    "created_at": "2026-11-12 09:30:00",
    "recipe_count": 0
  }
}
Field Type Meaning
data.id string The category’s id
data.slug string Unique among categories
data.description string|null Plain text
data.image_id string|null Attachment id. image_url is added when set
data.display_order string Manual position
data.recipe_count integer Recipes linked to it, in any status
data.language_code, data.translation_group string|null For multilingual sites

The status is 200, not 201.

Errors

Status Code When
400 rest_error name is missing or blank.
500 rest_error The category could not be written.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-recipe/v1/categories" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Brunch","description":"Late-morning dishes."}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/categories');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'        => 'Brunch',
        'description' => 'Late-morning dishes.',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-recipe/v1/categories', {
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name": "Brunch", "description": "Late-morning dishes."}),
});
const { data } = await response.json();

Quick Links

Share