---
title: "Collections · Leiho docs"
description: "Define content types and fields in Leiho."
url: https://leiho.dev/docs/collections
lang: en
updated: 2026-11-04
---
Guides

# Collections

Define content types and fields in Leiho.

Leiho Collections is a content model built into Leiho: "Strapi or Webflow collections inside WordPress", without ACF. A **collection** has many entries (Services, Articles); a **singleton** has exactly one (Home, Contact, Site settings).

- **Entries are WordPress posts** (one post type per collection): roles, drafts, scheduling, trash, revisions, the media library, SEO and multilingual plugins keep working.
- **Field values live in one table per collection** (`wp_leiho_<collection>`), one row per entry, not in postmeta: typed, indexed columns for scalar fields, JSON for lists, blocks and groups. MySQL 5.7+, MariaDB and the SQLite drop-in.
- **Field types**: text, rich text, code, number, boolean, date, date-time, select (single or multiple), slug, email, URL, color, image, file, gallery, link, reference (to another collection, one or many), list, blocks and group, nested freely.
- **Schema as code**: export the schema to `leiho.schema.json`, keep it in your front-end repository, import it on another site.
- **Safe migrations**: renaming a field is free (fields have a stable `key`), a type change copies values into a new column, and removed or retyped columns are archived, never dropped. `dry_run` shows the plan first.
- **Revisions** include field values: restoring a revision restores the fields too.
- **Same editor, same API**: entries are edited in the visual editor with the same dotted paths as ACF (`sections.2.items.1.title`), and served by `/leiho/v1/export`, `/content` and `/types` like any other content. ACF keeps working alongside.

```json
{
  "leiho": "collections",
  "version": 1,
  "collections": [
    { "id": "service", "label": "Services", "singular_label": "Service", "path": "/services/{slug}", "fields": [
      { "name": "price", "type": "number", "min": 0 },
      { "name": "faq", "type": "list", "fields": [
        { "name": "question", "type": "text", "required": true },
        { "name": "answer", "type": "richtext" }
      ] },
      { "name": "related", "type": "reference", "to": ["service"], "multiple": true, "max": 3 }
    ] }
  ]
}
```

**Schema builder.** Leiho → **Collections** builds the same schema without writing JSON: collections and single pages, labels, URL pattern, built-in features, and a field editor with all 20 types and their options (choices, min / max, reference targets, sub-fields of lists and groups, block types of a blocks field), reordered by drag and drop or with the keyboard. Field keys are generated from the name and fixed once applied; only the name and the label change afterwards. **Review** runs the migration as a dry run and lists what will happen (new columns, conversions, archived columns) before anything is applied; validation errors point at the field concerned. Archived columns are listed with a purge button (type the collection id to confirm), and `leiho.schema.json` is one click away for import and export. Entries are then edited in Leiho → **Collections** (and in the visual editor when the collection has a URL). **+ New collection** at the bottom of the list of types starts a new one.

Updated November 4, 2026[Something unclear on this page? Tell us →](https://github.com/pixelersagency/leiho/issues/new?title=Docs%3A%20Collections)
