Nahnu Code & API Block icon
Page Builders & Blocks

Nahnu Code & API Block hooks reference

Nahnu Code & API Block 1.0.4 has 1 actions and 18 filters, read directly from its source code on Nov 19, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Nahnu Code & API Block fires an action
add_action( 'nahnu_code_block_assets_enqueued', function() {
	// Your code runs here.
}, 10, 1 );

// Change a value Nahnu Code & API Block is about to use
add_filter( 'nahnu_code_block_pre_attributes', function( $value, $attributes ) {
	// Change $value here.
	return $value;
}, 10, 2 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • blocks/code-block/render.php line 144 · used in 4 places
    /**
     * Filter extra HTML attributes added to each `<pre>` element this block
     * renders (both the inline preview and the "view all code" modal use the same
     * set). Return an associative array of attribute name => value.
     */
    apply_filters( 'nahnu_code_block_pre_attributes', array(), $attributes );
  • includes/class-nahnu-code-block.php line 1127
    /**
     * Fires once per request, the first time any Nahnu Code Block asset is
     * enqueued (i.e. the plugin has confirmed one of its blocks is actually
     * present on the page). Useful for a theme or plugin that wants to add its own
     * inline style/script only when these blocks are in play.
     */
    do_action( 'nahnu_code_block_assets_enqueued' );
  • blocks/code-block/render.php line 80
    /**
     * Filter the collapsed line count for every Nahnu Code Block instance.
     */
    apply_filters( 'nahnu_code_block_collapsed_lines', $nahnu_code_block_collapsed_lines );
  • includes/class-nahnu-code-block-core-code.php line 105
    /**
     * Filter the languages offered for WordPress's core Code block. Keys must be
     * Prism language ids (or aliases) bundled with this plugin; values are the
     * labels shown in the editor dropdown.
     */
    apply_filters( 'nahnu_code_block_core_code_languages', $languages );
  • includes/class-nahnu-code-block-core-code.php line 272
    /**
     * Filter the Nahnu Code Block attributes used when "Replace" mode renders a
     * core Code block (e.g. to turn off line numbers or the theme toggle for all
     * replaced blocks).
     */
    apply_filters( 'nahnu_code_block_core_code_replace_attributes', $nahnu_attrs, $attrs );
  • includes/class-nahnu-code-block.php line 388
    /**
     * Filters the stylesheet handles nahnu_code_block_render_block() force-prints
     * when a block renders after wp_head() has already run. Add your own handle
     * here if you register additional CSS from a nahnu_code_block_*_render_*
     * callback via a filter such as `nahnu_code_block_openapi_*_attributes`.
     */
    apply_filters( 'nahnu_code_block_late_style_handles', array( 'nahnu-code-block-style', 'nahnu-code-block-api-style', 'nahnu-code-block-prism-line-numbers', ) );
  • includes/class-nahnu-code-block-openapi.php line 536
    /**
     * Filters the Auth block attributes built from one OpenAPI security scheme,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_auth_attributes', $attrs, $requirement, $security_schemes );
  • includes/class-nahnu-code-block-openapi.php line 185
    /**
     * Filters the set of blocks generated for one callback operation, after the
     * normal per-block filters have already run (via
     * nahnu_code_block_openapi_build_operation_blocks()).
     */
    apply_filters( 'nahnu_code_block_openapi_callback_blocks', $blocks, $callback_name, $expression, $operation );
  • includes/class-nahnu-code-block-openapi.php line 322
    /**
     * Filters the Endpoint block attributes built from one OpenAPI operation,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_endpoint_attributes', $attrs, $operation );
  • includes/class-nahnu-code-block-openapi.php line 128
    /**
     * Filters the complete set of generated block markup for one OpenAPI
     * operation. Add, remove, or reorder entries — the array is only
     * concatenated by nahnu_code_block_openapi_concatenate_blocks(), so a caller
     * building their own post_content directly can ignore ordering here entirely
     * and just read the keys they want.
     */
    apply_filters( 'nahnu_code_block_openapi_operation_blocks', $blocks, $operation );
  • includes/class-nahnu-code-block-openapi.php line 375
    /**
     * Filters the Parameters block attributes built from one OpenAPI operation,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_parameters_attributes', $attrs, $operation );
  • includes/class-nahnu-code-block-openapi.php line 446
    /**
     * Filters the Response Body block attributes built from one OpenAPI operation,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_response_body_attributes', $attrs, $operation );
  • includes/class-nahnu-code-block-openapi.php line 271
    /**
     * Filters the Parameters block attributes built for a named schema definition
     * (as opposed to an operation's own inline parameters — see
     * nahnu_code_block_openapi_parameters_attributes for that case).
     */
    apply_filters( 'nahnu_code_block_openapi_schema_definition_attributes', $attrs, $name, $schema );
  • includes/class-nahnu-code-block-openapi.php line 233
    /**
     * Filters the Servers block attributes built from an OpenAPI `servers` array,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_servers_attributes', $attrs, $servers );
  • includes/class-nahnu-code-block-openapi.php line 494
    /**
     * Filters the Status Codes block attributes built from one OpenAPI operation,
     * before markup is generated.
     */
    apply_filters( 'nahnu_code_block_openapi_status_codes_attributes', $attrs, $operation );
  • includes/class-nahnu-code-block.php line 743
    /**
     * Filters the CSS custom property values used for a given theme mode ('light'
     * or 'dark'). Return a full or partial array — unspecified keys keep their
     * default value.
     */
    apply_filters( 'nahnu_code_block_theme_variables', $vars, $mode );
  • blocks/code-block/render.php line 169
    /**
     * Filter the wrapper CSS classes for a Nahnu Code Block instance.
     */
    apply_filters( 'nahnu_code_block_wrapper_classes', $nahnu_code_block_wrapper_classes, $attributes );
  • includes/class-nahnu-code-block.php line 758
    apply_filters( 'nahnu_code_block_dark_mode_selectors', array( 'html[data-theme="dark"]', 'body.dark-mode', 'body.dark-theme', ) );
  • includes/class-nahnu-code-block.php line 778
    apply_filters( 'nahnu_code_block_light_mode_selectors', array() );

Generated from Nahnu Code & API Block's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Done for you

Rather have it built for you?

Tell us what should change and we’ll write and test the code using these hooks.

Plugin customisation

from $149

New features or changed behaviour, without editing the plugin’s files.

  • Built as a companion plugin, so updates never wipe it
  • Exact quote before we start
  • Tested on staging, then deployed

Typical turnaround: 3–7 business days

Choose this

Not sure which fits? Describe what you need and we’ll suggest the simplest option.

Can't find the right hook?

We can build the customisation for you. Describe what you need: