Skip to content

Content Fields Hooks and Filters Reference

Table of Contents

Content Fields exposes filters and actions so you can change how values are read and written, override how post types and taxonomies register, and react when a definition changes — without touching plugin code.

What It Does

Nexter Extension 4.9.0 ships 18 filters and 4 actions in Content Fields. This page lists all of them with their signatures; the linked pages cover the ones you are most likely to use.

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.

Add a Hook

  1. Put the code in a child theme, a small plugin, or a Nexter code snippet — never in the plugin itself, which an update would overwrite.
A field group open in the builder, showing the field names hooks are keyed on
  1. Hook early enough. Value filters run whenever a value is read or written, so ordinary add_filter() placement is fine.
  1. Always return a value from a filter. Returning nothing replaces the value with null.
  1. Check the field or key first, so your change applies only where you mean it to.

Display the Value

Every hook in Content Fields 4.9.0, with its signature:

// ---- Values -------------------------------------------------------------
apply_filters( 'nxt/format_value',  $value, $field, $object_id );
apply_filters( 'nxt/update_value',  $value, $field, $object_id );
apply_filters( 'nxt/pre_load_field', null,  $selector, $object_id );
apply_filters( 'nxt/load_field',    $value, $selector, $object_id );
apply_filters( 'nxt/pre_format_field_value',   null, $value, $field );
apply_filters( 'nxt/pre_sanitize_field_value', null, $raw, $field, $renderer );

// ---- Field types and rendering ------------------------------------------
apply_filters( 'nxt/field_type_catalog', $catalog );
apply_filters( 'nxt/render_field_input', false, $field, $meta_key, $input_name, $value, $value_exists, $renderer );

// ---- Registration -------------------------------------------------------
apply_filters( 'nxt/register_post_type_args', $cpt_args, $key, $args );
apply_filters( 'nxt/register_taxonomy_args',  $params,   $key, $args );
apply_filters( 'nxt/validate_cpt_supports',   null,      $supports );
apply_filters( 'nxt/register_field_meta',      true,  $field, $meta_key, $object_type );
apply_filters( 'nxt/register_field_meta_args', $args, $field, $meta_key, $object_type );
apply_filters( 'nxt/pre_field_meta_rest_config', null, $field );

// ---- Migration ----------------------------------------------------------
apply_filters( 'nxt/import_sources', $sources );

// ---- Storage and capabilities -------------------------------------------
apply_filters( 'nexter_content_types_model_dir', $dir );
apply_filters( 'nexter_content_types_non_grantable_capabilities', $caps );
apply_filters( 'nexter_content_types_unsafe_capability_targets',  $unsafe );

// ---- Actions ------------------------------------------------------------
do_action( 'nxt/definition_saved',    $post_id, $kind, $meta );
do_action( 'nxt/definition_changed',  $post_id, $kind );
do_action( 'nxt/registered_post_type', $key, $object, $args );
do_action( 'nxt/registered_taxonomy',  $key, $object, $args );

Limitations

  • These hooks are specific to Nexter Content Fields. They are not compatible with ACF’s hooks, and ACF snippets will not work unchanged.
  • Value filters run on every read or write of a field. Keep the callbacks cheap — a slow filter is felt on every page that renders fields.
  • Hook names are a contract. Treat anything not listed here as internal and liable to change.

Troubleshooting

My filter runs but the value is unchanged

Check you are returning the value. A callback that ends without a return hands back null, and Nexter treats that as no value.

My filter affects every field, not one

Test the $field or $selector argument and return the original value untouched for everything else.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!