---
title: "nxt_group_definitions() — List Field Groups in Code"
url: https://nexterwp.com/docs/nxt-group-definitions/
date: 2026-09-14
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "nxt_group_definitions() returns every field group registered on the site, with its fields and its location rules. It is how you build something that adapts to whatever groups exist. What It..."
image: https://nexterwp.com/wp-content/uploads/2026/09/nxt-group-definitions-1024x519.jpg
word_count: 261
---

# nxt_group_definitions() — List Field Groups in Code

## Key Takeaways

- nxt_group_definitions() returns every field group registered on the site, including each group key, title, fields, and location rules.
- Nexter Extension is active and at least one field group exists before nxt_group_definitions() runs.
- Results are cached per request behind the model cache, and stale definitions may require clearing nxt_model_cache and nxt_ct_definitions_v1 in that order.

`nxt_group_definitions()` returns every field group registered on the site, with its fields and its location rules. It is how you build something that adapts to whatever groups exist.

## What It Does

Each entry carries the group key, its title, its fields and its rules. It is the same data the admin screen reads.

## Before You Start

- Nexter Extension is active.- At least one field group exists.

## Iterate the Groups

- Call `nxt_group_definitions()`.

![The Group Fields tab, listing the groups this function returns](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-s-group-fields-tab.webp)

- Loop the result; each entry is one group.

- Read `key`, `title` and `fields` from each.

- Use `nxt_group_definition()` if you want one specific group by key.

## Display the Value

Listing every group and its fields:

`<?php
foreach ( nxt_group_definitions() as $group ) {
printf( '<h3>%s</h3>', esc_html( $group['title'] ) );

foreach ( $group['fields'] as $field ) {
printf( '<li>%s (%s)</li>',
esc_html( $field['label'] ),
esc_html( $field['type'] ) );
}
}`

## Limitations

- Returns definitions, not values. To read a value, use `nxt_field_value()`.- Results are cached per request and behind the model cache. A definition changed on disk outside the admin may be served stale — see the cache troubleshooting doc.- This is a read surface. Creating or changing groups goes through the admin or the Content Fields REST routes.

## Troubleshooting

### A group I just created on the server is missing

The model cache is stale. Clear `nxt_model_cache` and `nxt_ct_definitions_v1` — both, in that order.

### I get groups that do not apply to my post

This function returns every group on the site. Filter by location rules yourself, or read values, which already respect them.

## Related Docs

- [Template functions reference](https://nexterwp.com/docs/nexter-fields-template-functions/)- [Display a custom field value](https://nexterwp.com/docs/display-custom-field-value-wordpress/)- [Field group changes not showing](https://nexterwp.com/docs/field-group-changes-not-showing-cache/)

## Frequently Asked Questions

**Q: Why is nxt_group_definitions() returning groups that don't apply to my post?**
A: nxt_group_definitions() returns every field group on the site, not just the ones that match the current post. That is useful when you need a full inventory of groups, but it also means location rules are included as data rather than enforced for you. If you only want post-specific output, filter by the location rules yourself or use values that already respect them.

**Q: How do I list all field groups and their fields in code?**
A: nxt_group_definitions() gives you the full set of registered field groups, including each group key, title, fields, and location rules. The page shows a simple loop over the result, then a nested loop over each group’s fields. That pattern is useful when your output needs to adapt to whatever groups exist instead of hardcoding field names.

**Q: What is the difference between nxt_group_definitions() and nxt_group_definition()?**
A: nxt_group_definitions() returns every field group registered on the site, while nxt_group_definition() is for one specific group by key. That split matters when you are building a dynamic screen versus targeting a known group. Use the plural form when you need to iterate everything, and the singular form when you already know the exact group key.

**Q: Why am I seeing stale field group data after changing a group on disk?**
A: The result can be stale because definitions are cached per request and behind the model cache. The page calls out that a definition changed on disk outside the admin may still be served from cache. In that case, clear nxt_model_cache and nxt_ct_definitions_v1 in that order so the newer definition can surface.

**Q: What do I need before using nxt_group_definitions()?**
A: Nexter Extension has to be active, and at least one field group must already exist. Without those two pieces, there is nothing for nxt_group_definitions() to return. That matters because this function reads registered definitions only, so it depends on both the extension being available and actual groups being present.

**Q: Can I use nxt_group_definitions() to read field values?**
A: nxt_group_definitions() is for definitions, not values. It returns metadata like the group title, fields, and location rules, which is useful for building adaptive output or admin-style listings. When you need the actual stored value for a field, use [Display a custom field value](https://nexterwp.com/docs/display-custom-field-value-wordpress/) or nxt_field_value().
