Jump to Navigation Jump to Main Content Jump to Footer
Home » Docs » Features » Custom action and filter hooks

Custom action and filter hooks

Chisel provides an extensive system of WordPress action and filter hooks that allow you to customize and extend theme functionality without modifying core files. Hooks are organized by domain — assets, blocks, AJAX, Twig, ACF, WooCommerce — making it easy to find the right extension point.

All hooks follow WordPress naming conventions with a chisel_ prefix. Action hooks enable you to execute custom code at specific points in the theme’s lifecycle, while filter hooks let you modify data before it’s used. Use these hooks in custom classes to safely extend Chisel.

The theme’s architecture uses hooks extensively: asset registration, block rendering, cache management, Twig function registration, and more. Every major subsystem exposes hooks, ensuring you never need to fork or modify core theme files.

Hook naming conventions

Prefix: All Chisel hooks use the chisel_ prefix

Format:

  • Actions: chisel_{subsystem}_{action}
  • Filters: chisel_{subsystem}_{data_type}

Examples:

  • chisel_twig_register_functions (action)
  • chisel_frontend_scripts (filter)
  • chisel_timber_acf_blocks_data (filter)

Asset hooks

Registration filters

Apply during init hook, before assets are registered:

Frontend assets

chisel_frontend_styles

Filters frontend stylesheets array before registration.

add_filter( 'chisel_frontend_styles', array( $this, 'custom_frontend_styles' ) );

public function custom_frontend_styles( array $styles ): array {
    $styles['custom-style'] = array(
        'deps' => array( 'chisel-main' ),
    );
    return $styles;
}
PHP

chisel_frontend_scripts

Filters frontend scripts array before registration.

add_filter( 'chisel_frontend_scripts', array( $this, 'custom_frontend_scripts' ) );

public function custom_frontend_scripts( array $scripts ): array {
    $scripts['custom-script'] = array(
        'deps' => array( 'jquery' ),
        'localize' => array(
            'name' => 'customData',
            'data' => array( 'apiKey' => get_option( 'api_key' ) ),
        ),
    );
    return $scripts;
}
PHP

chisel_frontend_footer_styles

Filters frontend footer stylesheets array before registration.

Admin assets

chisel_admin_styles

Filters admin stylesheets array.

chisel_admin_scripts

Filters admin scripts array.

Editor assets

chisel_editor_styles

Filters block editor stylesheets array.

chisel_editor_scripts

Filters block editor scripts array.

Login assets

chisel_login_styles

Filters login page stylesheets array.

chisel_login_scripts

Filters login page scripts array.

Pre-enqueue filters

Apply during enqueue hooks, before individual assets are enqueued:

  • chisel_pre_enqueue_frontend_styles
  • chisel_pre_enqueue_frontend_footer_styles
  • chisel_pre_enqueue_frontend_scripts
  • chisel_pre_enqueue_admin_styles
  • chisel_pre_enqueue_admin_scripts
  • chisel_pre_enqueue_editor_styles
  • chisel_pre_enqueue_editor_scripts
  • chisel_pre_enqueue_login_styles
  • chisel_pre_enqueue_login_scripts
add_filter( 'chisel_pre_enqueue_frontend_scripts', array( $this, 'custom_pre_enqueue_frontend_scripts' ) );

public function custom_pre_enqueue_frontend_scripts( array $scripts ): array {
    if ( ! is_user_logged_in() ) {
        unset( $scripts['admin-bar-tweaks'] );
    }
    return $scripts;
}
PHP

Per-asset enqueue filters

Apply during enqueue, for each asset individually:

  • chisel_enqueue_frontend_style
  • chisel_enqueue_frontend_footer_style
  • chisel_enqueue_frontend_script
  • chisel_enqueue_admin_style
  • chisel_enqueue_admin_script
  • chisel_enqueue_editor_style
  • chisel_enqueue_editor_script
  • chisel_enqueue_login_style
  • chisel_enqueue_login_script

Parameters: $enqueue (bool), $handle (string), $args (array)

add_filter( 'chisel_enqueue_frontend_script', array( $this, 'custom_enqueue_frontend_script' ), 10, 3 );

public function custom_enqueue_frontend_script( bool $enqueue, string $handle, array $args ): bool {
    if ( $handle === 'map' && ! is_page_template( 'templates/page-map.php' ) ) {
        return false;
    }
    return $enqueue;
}
PHP

Script registration

chisel_block_register_script_args

Filters script registration arguments for blocks.

Parameters: $args (array), $handle (string), $block (string)

add_filter( 'chisel_block_register_script_args', array( $this, 'custom_block_register_script_args' ), 10, 3 );

public function custom_block_register_script_args( array $args, string $handle, string $block ): array {
    $args['strategy'] = 'async';
    return $args;
}
PHP

chisel_blocks_register_scripts

Controls whether custom script registration is enabled.

add_filter( 'chisel_blocks_register_scripts', '__return_false' );
PHP

Cache and environment

chisel_environment_cache

Controls whether environment-based caching is enabled.

add_filter( 'chisel_environment_cache', '__return_true' );
PHP

chisel_cache_expiry

Filters cache expiration time.

add_filter( 'chisel_cache_expiry', array( $this, 'custom_cache_expiry' ) );

public function custom_cache_expiry(): int {
    return DAY_IN_SECONDS;
}
PHP

Twig hooks

Function registration

chisel_twig_register_functions

Allows registering custom Twig functions.

Parameters: $twig (Twig\Environment), $twig_instance (Chisel\WP\Twig)

add_action( 'chisel_twig_register_functions', array( $this, 'custom_twig_register_functions' ), 10, 2 );

public function custom_twig_register_functions( $twig, $twig_instance ) {
    $twig_instance->register_function( $twig, 'custom_function', 'custom_callback' );
}
PHP

Filter registration

chisel_twig_register_filters

Allows registering custom Twig filters.

Parameters: $twig (Twig\Environment), $twig_instance (Chisel\WP\Twig)

add_action( 'chisel_twig_register_filters', array( $this, 'custom_twig_register_filters' ), 10, 2 );

public function custom_twig_register_filters( $twig, $twig_instance ) {
    $twig_instance->register_filter( $twig, 'custom_function', 'custom_callback' );
}
PHP

Block hooks

ACF block rendering

chisel_timber_acf_blocks_data

Filters ACF block context data globally for all blocks.

Parameters: $context (array), $block (array), $post_id (int)

add_filter( 'chisel_timber_acf_blocks_data', array( $this, 'custom_timber_acf_blocks_data' ), 10, 3 );

public function custom_timber_acf_blocks_data( array $context, array $block, int $post_id ): array {
    $context['site_name'] = get_bloginfo( 'name' );
    return $context;
}
PHP

chisel_timber_acf_blocks_data_{slug}

Filters ACF block context data for specific block slug.

add_filter( 'chisel_timber_acf_blocks_data_slider', array( $this, 'custom_timber_acf_blocks_data_slider' ), 10, 3 );

public function custom_timber_acf_blocks_data_slider( array $context, array $block, int $post_id ): array {
    $context['autoplay'] = true;
    return $context;
}
PHP

chisel_timber_acf_blocks_data_{block_id}

Filters ACF block context data for specific block instance.

add_filter( 'chisel_timber_acf_blocks_data_block-my-block', array( $this, 'custom_timber_acf_blocks_data_block_my_block' ), 10, 3 );

public function custom_timber_acf_blocks_data_block_my_block( array $context, array $block, int $post_id ): array {
    $context['custom_setting'] = 'value';
    return $context;
}
PHP

Block categories

chisel_block_categories

Filters custom block categories.

add_filter( 'chisel_block_categories', array( $this, 'custom_block_categories' ) );

public function custom_block_categories( array $categories ): array {
    $categories[] = array(
        'slug' => 'custom-category',
        'title' => __( 'Custom Blocks', 'chisel' ),
    );
    return $categories;
}
PHP

Block styles

chisel_load_separate_core_block_assets

Controls whether core block styles load separately or as single file.

add_filter( 'chisel_load_separate_core_block_assets', '__return_true' );
PHP

chisel_styles_inline_size_limit

Filters maximum size for inline critical CSS (default: 10000 bytes).

add_filter( 'chisel_styles_inline_size_limit', array( $this, 'custom_styles_inline_size_limit' ) );

public function custom_styles_inline_size_limit(): int {
    return 15000;
}
PHP

AJAX hooks

Route registration

chisel_ajax_routes

Filters AJAX endpoint routes.

Parameters: $routes (array)

add_filter( 'chisel_ajax_routes', array( $this, 'custom_ajax_routes' ) );

public function custom_ajax_routes( array $routes ): array {
    $routes['custom-endpoint'] = array(
        'methods' => 'POST',
        'handler' => \Chisel\Ajax\Custom\CustomEndpoint::class, // By default it looks for CustomEndpoint, use handler for custom naming
    );
    return $routes;
}
PHP

Permission checks

chisel_ajax_permissions_check

Filters AJAX endpoint permission check.

Parameters: $allowed (bool), $endpoint_class (string), $request (WP_REST_Request)

add_filter( 'chisel_ajax_permissions_check', array( $this, 'custom_ajax_permissions_check' ), 10, 3 );

public function custom_ajax_permissions_check( bool $allowed, string $endpoint_class, \WP_REST_Request $request ): bool {
    if ( $endpoint_class === 'chisel-ajax-custom-publicendpoint' ) {
        return true; // Allow public access
    }
    return $allowed;
}
PHP

Custom Post Type hooks

CPT registration

chisel_custom_post_types

Filters custom post types array before registration.

add_filter( 'chisel_custom_post_types', array( $this, 'custom_post_types' ));

public function custom_post_types( array $post_types ): array {
    $post_types['portfolio'] = array(
        'singular' => __( 'Portfolio Item', 'chisel' ),
        'plural' => __( 'Portfolio', 'chisel' ),
        'menu_icon' => 'dashicons-portfolio',
        'supports' => array( 'title', 'editor', 'thumbnail' ),
    );
    return $post_types;
}
PHP

Taxonomy registration

chisel_custom_taxonomies

Filters custom taxonomies array before registration.

add_filter( 'chisel_custom_taxonomies', array( $this, 'custom_taxonomies' ));

public function custom_taxonomies( array $taxonomies ): array {
    $taxonomies['skill'] = array(
        'singular' => __( 'Skill', 'chisel' ),
        'plural' => __( 'Skills', 'chisel' ),
        'post_types' => array( 'portfolio' ),
        'hierarchical' => false,
    );
    return $taxonomies;
}
PHP

Default supports

chisel_default_post_type_supports

Filters default CPT supports.

add_filter( 'chisel_default_post_type_supports', array( $this, 'custom_default_post_type_supports' ));

public function custom_default_post_type_supports( array $supports ): array {
    $supports[] = 'excerpt';
    return $supports;
}
PHP

chisel_default_post_type_supports_{post_type}

Filters default supports for specific post type.

add_filter( 'chisel_default_post_type_supports_portfolio', array( $this, 'portfolio_default_post_type_supports' ));

public function portfolio_default_post_type_supports( array $supports ): array {
    $supports[] = 'page-attributes';
    return $supports;
}
PHP

Default rewrite args

chisel_default_post_type_rewrite_args

Filters default CPT rewrite arguments.

chisel_default_post_type_rewrite_args_{post_type}

Filters default rewrite arguments for specific post type.

chisel_default_taxonomy_rewrite_args

Filters default taxonomy rewrite arguments.

chisel_default_taxonomy_rewrite_args_{taxonomy}

Filters default rewrite arguments for specific taxonomy.

Default capabilities

chisel_default_taxonomy_capabilities

Filters default taxonomy capabilities.

chisel_default_taxonomy_capabilities_{taxonomy}

Filters default capabilities for specific taxonomy.


ACF hooks

Options pages

chisel_acf_options_pages

Filters ACF options pages array.

add_filter( 'chisel_acf_options_pages', array( $this, 'custom_acf_options_pages' ));

public function custom_acf_options_pages( array $pages ): array {
    $pages[] = array(
        'menu_slug' => 'site-options',
        'page_title' => __( 'Site Options', 'chisel' ),
        'icon_url' => 'dashicons-admin-generic',
    );
    return $pages;
}
PHP

chisel_acf_options_sub_pages

Filters ACF options subpages array.

add_filter( 'chisel_acf_options_sub_pages', array( $this, 'custom_acf_options_sub_pages' ));

public function custom_acf_options_sub_pages( array $subpages ): array {
    $subpages[] = array(
        'menu_slug' => 'site-footer',
        'page_title' => __( 'Footer Options', 'chisel' ),
        'parent_slug' => 'site-options',
    );
    return $subpages;
}
PHP

Color palettes

chisel_acf_colors_palette

Filters ACF color picker palette.

add_filter( 'chisel_acf_colors_palette', array( $this, 'custom_acf_colors_palette' ));

public function custom_acf_colors_palette( array $colors ): array {
    $colors[] = '#custom-color';
    return $colors;
}
PHP

chisel_tinymce_colors_palette

Filters TinyMCE color picker palette.


Theme hooks

Environment

chisel_is_dev_env

Filters whether environment is development.

add_filter( 'chisel_is_dev_env', array( $this, 'is_dev_env' ));

public function is_dev_env(): bool {
    return defined( 'MY_DEV_MODE' ) && MY_DEV_MODE;
}
PHP

Icons (sprite) module

chisel_use_icons_module

Filters whether to use icon sprite module.

add_filter( 'chisel_use_icons_module', '__return_true' );
PHP

Hook reference summary

Asset hooks (11 registration + 9 pre-enqueue + 9 per-asset)

  • Frontend: styles, scripts, footer styles
  • Admin: styles, scripts
  • Editor: styles, scripts
  • Login: styles, scripts

Twig hooks (3)

  • chisel_twig_register_functions
  • chisel_twig_register_filters
  • chisel_twig_register_tests

Block hooks (6+)

  • chisel_timber_acf_blocks_data (global)
  • chisel_timber_acf_blocks_data_{slug} (per block type)
  • chisel_timber_acf_blocks_data_{block_id} (per instance)
  • chisel_block_categories
  • chisel_load_separate_core_block_assets
  • chisel_styles_inline_size_limit

AJAX hooks (2)

  • chisel_ajax_routes
  • chisel_ajax_permissions_check

CPT/Taxonomy hooks (8+)

  • chisel_custom_post_types
  • chisel_custom_taxonomies
  • chisel_default_post_type_supports + per-CPT variants
  • chisel_default_post_type_rewrite_args + per-CPT variants
  • chisel_default_taxonomy_rewrite_args + per-taxonomy variants
  • chisel_default_taxonomy_capabilities + per-taxonomy variants

ACF hooks (4)

  • chisel_acf_options_pages
  • chisel_acf_options_sub_pages
  • chisel_acf_colors_palette
  • chisel_tinymce_colors_palette

Theme hooks (4)

  • chisel_environment_cache
  • chisel_cache_expiry
  • chisel_is_dev_env
  • chisel_use_icons_module

Total: 50+ hooks with many more available through per-type and per-instance variants.

Do you like Chisel?

Give it a star on GitHub!