Field groups overview
3 min read
A field group is a named set of fields plus location rules that say where the set appears: on posts, pages and custom post types, on user profiles, on term screens, on comments, in widgets or on an options page.
What makes Mass Custom Fields different from a classic custom fields plugin is where the values go. Instead of adding one row per value to wp_postmeta, every field group gets one database table and every field becomes one column in it.
Classic custom fields | Mass Custom Fields |
|---|---|
One | One row per post in the group's table, one column per field |
Every value is text | Columns have real types: numbers are numbers, dates are dates |
Filtering means joining | Filtering is a normal indexed column lookup |
No control over the storage | Optional per-field index, unique index, column type, charset and generated values |
What you get
- A visual editor for the fields and the location rules (WPM Fields › Field Groups).
- Edit-screen boxes on posts, users, terms, comments, widgets and options pages, with required fields, validation rules and conditional logic. See Where field groups appear.
- Safe schema changes: renaming a field keeps its data, risky type changes keep a backup column, removed fields never drop data. See Changing a field group safely.
- A Table health panel that compares the definition with the real table. See Table health.
- Query posts by field value with
wpmcf_query_posts(). See Query posts by field value.
How the storage works
For a field group with the key product_details the plugin creates the table {prefix}wpmcf_fg_product_details (for example wp_wpmcf_fg_product_details). It contains:
Column | Meaning |
|---|---|
| Row id. |
| The WordPress id of the object the row belongs to (post id, user id, term id, comment id, ...). Only present once the group has location rules. |
| What |
one column per field | The field values. Group and repeater fields keep all their sub-fields in one JSON column. |
| Set by the database. |
mid and mtype together are unique, so a post has at most one row per group. This also means you can join the table yourself:
SELECT p.post_title, d.price
FROM wp_posts p
JOIN wp_wpmcf_fg_product_details d ON d.mid = p.ID AND d.mtype = 'posts'
WHERE d.price < 100;Limits worth knowing
Limit | Value |
|---|---|
Columns per field group | 100 (a warning appears from 40 columns). Use a Group field to bundle related values into one JSON column. |
Indexed fields per group | A warning from 8, an error above 20. |
Group key length | 63 characters. |
Field key length | 63 characters, or less for field types that add extra columns (for example Map). |
Free and Pro
Everything on these pages is available in the free plugin. Three details depend on the plan:
- Advanced field types (Gallery, Flexible content, Clone) need Pro. See Pro field types.
- Location rules for WooCommerce orders need Pro. See Location rules.
- Per-field In translations modes (WPML/Polylang) need Business. See Field settings: display and advanced.
Where to go next
I want to... | Read |
|---|---|
Create my first group | |
Add and arrange fields | |
Decide where a group appears | |
Choose a field type | |
Print values in a theme | |
Fix a table problem |
Still stuck? Contact support