nxt_print_field() echoes a field value with escaping applied, so the common case needs one line instead of three.
What It Does
It is nxt_field_value() plus output escaping. Use it when you want to print a value as-is and nothing more.
Before You Start
- Nexter Extension is installed and active, so the template functions exist.
- You know the field’s Field Name — not its label.
- You are editing a theme template, a template part, or a plugin.
Print a Value
- Call
nxt_print_field()where the value should appear.
- Pass the field name, and an object if it is not the current post.
- For anything that needs wrapping markup or a condition, use
nxt_field_value()instead and build the output yourself.
Display the Value
The short form, and its longhand equivalent:
<?php
// short
nxt_print_field( 'reference' );
// equivalent
echo esc_html( nxt_field_value( 'reference' ) );
Limitations
- Escapes for HTML text. It is not the right function for a value going into an attribute or a URL — use
nxt_field_value()withesc_attr()oresc_url(). - Not suitable for a WYSIWYG field, whose value is HTML. Use
wp_kses_post( nxt_field_value( ... ) ). - Prints nothing when the value is empty, which is usually what you want but means you cannot show a fallback.
Troubleshooting
My rich text shows visible tags
A WYSIWYG value is HTML and this function escapes it. Use wp_kses_post() instead.
I need a default when the field is empty
Read with nxt_field_value(), test it, and echo your fallback.










