Skip to content

nxt_field_values() — Read Every Field on a Post

Key Takeaways

  • nxt_field_values() returns every field value on an object at once, keyed by field name, so it saves a call per field when most fields are needed.
  • Nexter Extension is active, the field’s Field Name is known, and the code runs in a template or a plugin before calling nxt_field_values().
  • nxt_field_values_raw() returns unformatted values and ignores conditional logic, while nxt_field_values() omits fields hidden by conditional logic or unmatched location rules.
Table of Contents

nxt_field_values() returns every field value on an object at once, keyed by field name. It saves a call per field when you need most of them.

What It Does

One call, one array. Each key is a field name and each value is already formatted according to that field’s return-format setting.

Before You Start

  • Nexter Extension is active.
  • You know the field’s Field Name.
  • You are editing a template or a plugin.

Read Them All

  1. Call nxt_field_values(), optionally with an object.
  1. Treat the result as an array keyed by field name.
  1. Check a key exists before using it — a field with no value may be absent rather than empty.
  1. Escape each value for the context you print it into.

Display the Value

Reading, and the raw variant:

<?php
$all = nxt_field_values();

if ( isset( $all['reference'] ) ) {
    echo esc_html( $all['reference'] );
}

// every value on another post
$other = nxt_field_values( 123 );

// unformatted, ignoring conditional logic
$raw = nxt_field_values_raw();

Limitations

  • Only fields from groups whose location rules match the object are included.
  • Fields hidden by conditional logic are omitted. nxt_field_values_raw() ignores that.
  • Reading everything is not always cheaper. If you need two fields out of thirty, two calls to nxt_field_value() are clearer.

Troubleshooting

A field I expected is not in the array

Either it has no value, or its conditional logic is unmet. Try nxt_field_values_raw() to see what is actually stored.

The array is empty

No field group’s location rules match this object, so there are no fields to read.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!

Related Frequently Asked Questions

Why is my field missing from nxt_field_values() even though I know it exists?

A missing field usually means either the field has no value or its conditional logic is not met. nxt_field_values() only returns fields that are actually available for the current object, so an empty-looking result can still be correct. If you need to see what is stored regardless of conditional logic, use nxt_field_values_raw(). That makes it easier to separate “not returned” from “not saved.”

How do I read all custom fields for another post with nxt_field_values()?

nxt_field_values() can take an object ID, so you are not limited to the current post. The page shows $other = nxt_field_values( 123 );, which means you can pull the full field array for another object in one call. That is useful when a template needs to render related content without making one request per field.

Should I use nxt_field_values() or nxt_field_value() when I only need a couple of fields?

If you only need two fields out of thirty, separate nxt_field_value() calls are clearer and may be the better choice. nxt_field_values() is best when you need most of the fields at once because it saves a call per field. The tradeoff matters: fewer calls sounds efficient, but reading everything is not always cheaper if you only print a small subset.

What does nxt_field_values_raw() do differently from nxt_field_values()?

nxt_field_values_raw() returns the unformatted values and ignores conditional logic. That makes it useful when you want to inspect what is actually stored instead of what the formatted API exposes. In contrast, nxt_field_values() returns each value already formatted according to the field’s return-format setting, so it is better for direct output in templates.

What do I need before using nxt_field_values() in a template?

The basics are simple: Nexter Extension must be active, you need the field’s Field Name, and you should be editing a template or a plugin. Those three pieces matter because the function reads by field name and works in template-level code. Without them, there is nothing reliable to fetch or display.

How should I output values from nxt_field_values() safely?

Treat the result as an array keyed by field name, then check that a key exists before using it. The page specifically warns that a field with no value may be absent rather than empty, so isset( $all['reference'] ) is the safer pattern. Escape each value for the context you print it into, which matters because formatted data still needs proper output handling.

Last reviewed: November 12, 2026

Related Docs