---
title: "nxt/format_value — Change a Field Value Before It Is Displayed"
url: https://nexterwp.com/docs/nxt-format-value-filter/
date: 2026-11-12
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "nxt/format_value runs every time a field value is read for display. It is where you change how a value comes out without changing what is stored. What It Does The..."
image: https://nexterwp.com/wp-content/uploads/2026/09/nxt-format-value-filter-1024x519.jpg
word_count: 303
---

# nxt/format_value — Change a Field Value Before It Is Displayed

`nxt/format_value` runs every time a field value is read for display. It is where you change how a value comes out without changing what is stored.

## What It Does

The filter receives the formatted value, the field definition and the object ID. Whatever you return is what the template gets.

## Before You Start

- Nexter Extension 4.9.0 or later with Content Fields enabled.- Somewhere to add PHP — a child theme’s `functions.php`, a small plugin, or a Nexter code snippet.- You know the field or post type key you want to affect.

## Filter a Displayed Value

- Add a filter on `nxt/format_value` with three arguments.

![The Presentation tab, where the built-in display settings live](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-s-tab-presentation.webp)

- Test `$field['name']` so the change applies only to the field you mean.

- Return the original `$value` unchanged for everything else.

- Load a post that has the field and confirm the output changed.

## When to Use It

- Adding a currency symbol or unit without storing it.- Falling back to a site-wide default when a post leaves a field empty.- Normalising a value that was imported inconsistently.

## Display the Value

Formatting a price for display, leaving the stored number alone:

`<?php
add_filter( 'nxt/format_value', function ( $value, $field, $object_id ) {
if ( 'price' !== $field['name'] || '' === $value ) {
return $value; // always return the original
}
return '&pound;' . number_format_i18n( (float) $value );
}, 10, 3 );`

## Limitations

- This changes **display only**. The stored value is untouched, so sorting and `meta_query` still see the raw value.- It runs on every read. Keep the callback cheap.- It does not run for `nxt_field_value_raw()`, which is the point of that function.

## Troubleshooting

### Every field changed, not just mine

The `$field['name']` test is missing or wrong. Return `$value` untouched for fields you are not targeting.

### Values disappeared

A code path in the callback returns nothing. Every branch must return a value.

## Related Docs

- [Content Fields hooks reference](https://nexterwp.com/docs/nexter-fields-hooks-reference/)- [Template functions reference](https://nexterwp.com/docs/nexter-fields-template-functions/)