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.
// 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
-
/** * 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 ); -
/** * 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' ); -
/** * Filter the collapsed line count for every Nahnu Code Block instance. */ apply_filters( 'nahnu_code_block_collapsed_lines', $nahnu_code_block_collapsed_lines ); -
/** * 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 ); -
/** * 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 ); -
/** * 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', ) ); -
/** * 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 ); -
/** * 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 ); -
/** * Filters the Endpoint block attributes built from one OpenAPI operation, * before markup is generated. */ apply_filters( 'nahnu_code_block_openapi_endpoint_attributes', $attrs, $operation ); -
/** * 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 ); -
/** * Filters the Parameters block attributes built from one OpenAPI operation, * before markup is generated. */ apply_filters( 'nahnu_code_block_openapi_parameters_attributes', $attrs, $operation ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * Filter the wrapper CSS classes for a Nahnu Code Block instance. */ apply_filters( 'nahnu_code_block_wrapper_classes', $nahnu_code_block_wrapper_classes, $attributes ); -
apply_filters( 'nahnu_code_block_dark_mode_selectors', array( 'html[data-theme="dark"]', 'body.dark-mode', 'body.dark-theme', ) ); -
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.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin 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 thisNot 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: