---
title: "React When a Field Group Definition Changes"
url: https://nexterwp.com/docs/nxt-definition-changed-action/
date: 2026-11-12
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "Two actions fire when a definition is saved or changed. They are the hook to use for deploy automation, cache purging, or keeping something else in step with your data..."
image: https://nexterwp.com/wp-content/uploads/2026/09/nxt-definition-changed-action-1024x519.jpg
word_count: 378
---

# React When a Field Group Definition Changes

Two actions fire when a definition is saved or changed. They are the hook to use for deploy automation, cache purging, or keeping something else in step with your data model.

## What It Does

`nxt/definition_saved` fires when a definition is written, with the post ID, its kind and its meta. `nxt/definition_changed` is the broader signal that something in the model moved.

## Before You Start

- Nexter Extension 4.9.0 or later with Content Fields enabled.- Somewhere to add PHP — a child theme, a small plugin, or a Nexter code snippet.- You know the key you want to affect.

## Hook a Definition Change

- Add an action on `nxt/definition_saved` with three arguments, or `nxt/definition_changed` with two.

![The Group Fields tab, whose definitions these actions fire for](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-s-group-fields-tab.webp)

- Check the `$kind` if you only care about one — `group_fields`, `cpt` or `taxonomy`.

- Do your work: purge a cache, write a log line, trigger a rebuild.

- Keep it fast. These fire during an admin save.

## When to Use It

- Purging a page cache or CDN when the data model changes.- Logging model changes for an audit trail.- Triggering a static rebuild on a headless site.

## Display the Value

Purging a cache when a field group changes:

`<?php
add_action( 'nxt/definition_saved', function ( $post_id, $kind, $meta ) {
if ( 'group_fields' !== $kind ) {
return;
}
// your own cache, a CDN purge, a rebuild trigger
error_log( 'Field group saved: ' . ( $meta['key'] ?? '' ) );
}, 10, 3 );

add_action( 'nxt/definition_changed', function ( $post_id, $kind ) {
// broader signal - fires for model changes generally
}, 10, 2 );`

## Limitations

- These fire on definition changes, not on field **values**. Saving a post does not trigger them.- `nxt/definition_changed` can fire with a post ID of `0` when the change did not come from a single definition post. Do not assume a valid ID.- They run inside an admin request, so slow work here makes saving a field group feel slow. Queue anything heavy.

## Troubleshooting

### The action does not fire when I edit a post

Correct. These are for definition changes, not value changes. Use WordPress’ own `save_post` for values.

### I get a post ID of 0

Expected for changes that are not tied to one definition post. Guard before using the ID.

## Related Docs

- [Field group changes not showing](https://nexterwp.com/docs/field-group-changes-not-showing-cache/)- [Where Content Fields stores your field groups](https://nexterwp.com/docs/where-nexter-fields-stores-data/)- [Content Fields hooks reference](https://nexterwp.com/docs/nexter-fields-hooks-reference/)