Collections & Fields
How Pottr models structured application entities using 9 field types, strict validation, and normalized schemas.
What is a Collection?
In Pottr, a Collection represents a structured data entity — such as projects, tickets, invoices, or bookings. Unlike WordPress posts, collections do not use wp_posts or wp_postmeta, keeping your application data separated from editorial content.
Collection slugs must use lowercase alphanumeric characters with hyphens or underscores (matching ^[a-z][a-z0-9_-]*$).
The 9 Supported Field Types
| Type | Data Representation | Description & Sanitization |
|---|---|---|
text | String | Single-line text. Sanitized via WordPress sanitize_text_field(). |
textarea | String | Multi-line plain text. Sanitized via sanitize_textarea_field(). |
rich_text | String (HTML) | Formatted HTML text. Sanitized via wp_kses_post(). |
number | Number (int / float) | Stored and indexed as numeric values. |
boolean | Boolean (true / false) | Boolean flag. Normalized to standard boolean on output. |
date | String (ISO-8601) | Date/datetime string (e.g. 2026-05-10 or 2026-05-10T14:30:00Z). |
relation | Integer (Entry ID) | Foreign key ID referencing an entry in another collection. |
media | Integer (Attachment ID) | WordPress media attachment ID. |
json | Object / Array | Arbitrary structured JSON data payload. |
The Primary Title Field
Every collection in Pottr includes a primary title field (type text, required). If you declare a collection via Blueprints without a title field, Pottr automatically prepends it to the schema.
What Is Validated
On every POST, PUT and PATCH, Pottr checks the body against the collection’s schema:
- Keys that are not fields of the collection are rejected (
unknown_field). - Required fields must be present and non-empty (
missing_required). - Each value is coerced and sanitized for its field type; values that cannot be coerced are rejected (
invalid_field). relationandmediavalues must be positive integer IDs.
User-Owned Collections
Add a relation or number field with the key user_id and the collection becomes user-owned: Pottr fills in the signed-in user on create and limits reads and writes to their entries. See User-Owned Data.
Plan Limits
The number of collections and entries per collection depends on your plan. Hitting a limit returns 403 collection_limit_reached or 403 entry_limit_reached. See Plans, Limits & Licensing.