GenerateBlocks 2.5.1 has 4 actions and 100 filters, read directly from its source code on Nov 17, 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 GenerateBlocks fires an action
add_action( 'generateblocks_block_css_data', function( $arg1, $settings, $css, $desktop_css, $tablet_css, $tablet_only_css, $mobile_css ) {
// Your code runs here.
}, 10, 7 );
// Change a value GenerateBlocks is about to use
add_filter( 'generateblocks_query_loop_args', function( $args, $attributes, $arg3 ) {
// Change $args here.
return $args;
}, 10, 3 );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
-
/** * Do generateblocks_block_css_data hook */ do_action( 'generateblocks_block_css_data', 'button-container', $settings, $css, $desktop_css, $tablet_css, $tablet_only_css, $mobile_css ); -
/** * Legacy filter for v1 query args compatibility. */ apply_filters( 'generateblocks_query_loop_args', $args, $attributes, null === $block ? new stdClass() : $block ); -
/** * Whether to keep resolving dynamic tags inside an inline event handler (on*) * attribute. */ apply_filters( 'generateblocks_allow_dynamic_data_in_event_handlers', false, [ 'attribute' => $name, 'tags' => $tags, 'contexts' => $tag_contexts, ] ); -
/** * Allow developers to filter the content before dynamic tag replacement. */ apply_filters( 'generateblocks_before_dynamic_tag_replace', $content, [ 'full_tag' => $full_tag, 'tag' => $tag_name, 'replacement' => $replacement, 'og_replacement' => $og_replacement, 'block' => $block, 'instance' => $instance, 'options' => $options, 'supports' => $supports, ] ); -
/** * Filters the icon shown in the dashboard header tile for the current screen. */ apply_filters( 'generateblocks_dashboard_header_icon', $default_icon, $screen_id ); -
/** * Filters the at-rule presets offered by the Styles Builder. */ apply_filters( 'generateblocks_default_at_rules', $defaults ); -
/** * Allow users to filter the id option for a dynamic tag. */ apply_filters( 'generateblocks_dynamic_tag_id', $id, $options, is_object( $instance ) ? $instance : new stdClass() ); -
/** * Allow developers to filter the replacement. */ apply_filters( 'generateblocks_dynamic_tag_replacement', $replacement, [ 'tag' => $tag_name, 'full_tag' => $full_tag, 'content' => $content, 'block' => $block, 'instance' => $instance, 'options' => $options, 'supports' => $supports, ] ); -
/** * Allows filtering of the post record response data to add or alter data. */ apply_filters( 'generateblocks_dynamic_tags_post_record_response', $response, $id, $load, $options ); -
/** * Set the duration of the cache for dynamic tag replacements. */ apply_filters( 'generateblocks_dynamic_tags_replacement_cache_duration', 3600, $content, $context, $request ); -
/** * Allows filtering of the post record response data to add or alter data. */ apply_filters( 'generateblocks_dynamic_tags_user_record_response', $response, $id ); -
/** * Filters whether WordPress 7.0's core "Additional CSS" textarea is shown on * GenerateBlocks blocks. We disable it by default because our blocks have * their own CSS editing; return true to re-enable it. */ apply_filters( 'generateblocks_enable_core_additional_css', false ); -
/** * Whether to load the editor Pattern Library. */ apply_filters( 'generateblocks_enable_pattern_library', true ); -
/** * Whether to enforce the dynamic-data save gate. */ apply_filters( 'generateblocks_enforce_dynamic_data_save_gate', true, $context ); -
/** * Whether to enforce a save-gate rule. */ apply_filters( 'generateblocks_enforce_save_gate_rule', true, $rule['id'], $context ); -
/** * Allow a filter to set this meta value using some custom setter function * (such as get_field in ACF). If this value returns something we can skip * calling get_post_meta for it and return the value instead. */ apply_filters( 'generateblocks_get_meta_pre_value', null, $id, $key, $callable, $single_only ); -
/** * Filter the result of get_value for entity meta. */ apply_filters( 'generateblocks_get_meta_value', $value, $id, $key, $single_only, $callable ); -
/** * Allow users to filter the looper rendering of loop items. */ apply_filters( 'generateblocks_looper_render_loop_items', $output, $query_type, $query_data, $block, $attributes ); -
/** * Filter the scripts and styles a pattern preview loads. */ apply_filters( 'generateblocks_pattern_library_preview_assets', $assets, $pattern, $library ); -
/** * Modify the Query block's query data. */ apply_filters( 'generateblocks_query_data', $query_data, $query_type, $attributes, $block, $page ); -
/** * Filter the final calculated query args. */ apply_filters( 'generateblocks_query_wp_query_args', $args, $attributes, null === $block ? new stdClass() : $block, [ 'post_id' => $current_post_id, 'author_id' => $current_author_id, ] ); -
/** * Filter the args for get-wp-query calls before they're passed to * get_wp_query_args. */ apply_filters( 'generateblocks_rest_get_wp_query_args', $args, [ 'page' => $page, 'attributes' => $attributes, 'context' => $context, 'current' => $current, 'query_type' => $query_type, ] ); -
/** * Filter whether to restrict user_meta access. */ apply_filters( 'generateblocks_restrict_user_meta_access', true, $user_id, $current_user_id ); -
/** * Filters whether GenerateBlocks registers its own Settings screen. */ apply_filters( 'generateblocks_should_register_settings_page', true ); -
/** * Filter the map of supported GenerateBlocks features. */ apply_filters( 'generateblocks_supported_features', $features ); -
/** * SECURITY: returning true lets this user author dynamic tags whose output may * disclose protected meta, other users' meta, options, and cross-post data. * Grant only to fully trusted roles. */ apply_filters( 'generateblocks_user_can_author_dynamic_data', $default ); -
do_action( 'generateblocks_block_one_time_css_data', 'button-container', $settings, $css ); -
apply_filters( 'generateblocks_can_view_pattern_library', $this->edit_posts_permission() ); -
apply_filters( 'generateblocks_defaults', array( 'gridContainer' => array( 'horizontalGap' => 30, ), 'container' => array( 'paddingTop' => '40', 'paddingRight' => '40', 'paddingBottom' => '40', 'paddingLeft' => '40', 'width' => 50, 'widthMobile' => 100, 'gradientDirection' => 90, 'gradientColorOne' => '#ffffff', 'gradientColorOneOpacity' => 0.1, 'gradientColorTwo' => '#000000', 'gradientColorTwoOpacity' => 0.3, ), 'button' => array( 'g... ); -
apply_filters( 'generateblocks_do_inline_styles', false, [ 'content' => $content, 'data' => $data, ] ); -
apply_filters( 'generateblocks_dynamic_excerpt_more_link', sprintf( ' ... <a class="gb-dynamic-read-more" href="%1$s" aria-label="%3$s">%2$s</a>', esc_url( get_permalink( get_the_ID() ) ), wp_kses_post( $attributes['customMoreLinkText'] ), sprintf( _x( 'More on %s', 'more on post title', 'generateblocks' ), the_title_attribute( 'echo=0' ) ) ) ); -
apply_filters( 'generateblocks_force_validate_content', false, $content ); -
apply_filters( 'generateblocks_permissions', [ 'isAdminUser' => current_user_can( 'manage_options' ), 'canEditPosts' => current_user_can( 'edit_posts' ), 'isGbProActive' => is_plugin_active( 'generateblocks-pro/plugin.php' ), 'isGpPremiumActive' => is_plugin_active( 'gp-premium/gp-premium.php' ), ] ); -
apply_filters( 'generateblocks_query_per_page_default', 10, $args ); -
apply_filters( 'excerpt_length', 55 ); -
apply_filters( 'excerpt_more', ' ' . '[…]' ); -
apply_filters( 'generateblocks_after_container_close', $output, $attributes, $block ); -
apply_filters( 'generateblocks_after_container_open', $output, $attributes, $block ); -
apply_filters( 'generateblocks_allowed_option_keys_rest_api', [ 'siteurl', 'blogname', 'blogdescription', 'home', 'time_format', 'user_count', ] ); -
apply_filters( "generateblocks_attr_{$context}", $attributes, $settings, $context, $block ); -
apply_filters( "generateblocks_attr_{$context}_output", $output, $attributes, $settings, $context, $block ); -
apply_filters( 'generateblocks_background_image_url', $url, $settings ); -
apply_filters( 'generateblocks_before_container_close', $output, $attributes, $block ); -
apply_filters( 'generateblocks_before_container_open', $output, $attributes, $block ); -
apply_filters( 'generateblocks_block_css', $attributes['css'] ?? '', [ 'attributes' => $attributes ?? [], 'block_name' => static::$block_name ?? '', ] ); -
apply_filters( 'generateblocks_block_css_selector', $selector, $name, $attributes ); -
apply_filters( 'generateblocks_button_count', count( (array) $block->parsed_block['innerBlocks'] ), $attributes, $block ); -
apply_filters( 'generateblocks_container_allowed_tagnames', array( 'div', 'article', 'section', 'header', 'footer', 'aside', 'a', ), $attributes, $block ); -
apply_filters( 'generateblocks_container_tagname', $settings['tagName'], $attributes, $block ); -
apply_filters( 'generateblocks_css_data', [] ); -
apply_filters( 'generateblocks_css_output', generateblocks_get_compiled_css() ); -
apply_filters( 'generateblocks_dashboard_screens', array( 'generateblocks_page_generateblocks-settings', ) ); -
apply_filters( 'generateblocks_dashboard_tabs', array( 'settings' => array( 'name' => __( 'Settings', 'generateblocks' ), 'url' => admin_url( 'admin.php?page=generateblocks-settings' ), 'class' => 'generateblocks_page_generateblocks-settings' === $screen->id ? 'active' : '', ), ) ); -
apply_filters( 'generateblocks_default_block_styles', $defaultBlockStyles ); -
apply_filters( 'generateblocks_default_button_attributes', [ 'styles' => [ 'display' => 'inline-flex', 'alignItems' => 'center', 'backgroundColor' => '#215bc2', 'color' => '#ffffff', 'paddingTop' => '1rem', 'paddingRight' => '2rem', 'paddingBottom' => '1rem', 'paddingLeft' => '2rem', 'textDecoration' => 'none', '&:is(:hover, :focus)' => [ 'backgroundColor' => '#1a4a9b', 'color' => '#ffffff', ], ], ] ); -
apply_filters( 'generateblocks_default_open_pattern_category', '' ); -
apply_filters( 'generateblocks_default_open_pattern_library', 'gb_default_pro_library' ); -
apply_filters( 'generateblocks_do_activation_redirect', get_option( 'generateblocks_do_activation_redirect', false ) ); -
apply_filters( 'generateblocks_do_content', $content ); -
apply_filters( 'generateblocks_dynamic_background_image_url', $url, $attributes ); -
apply_filters( 'generateblocks_dynamic_content_allowed_html', $tags, $context ); -
apply_filters( 'generateblocks_dynamic_content_author_meta', $value, $author_id, $attributes ); -
apply_filters( 'generateblocks_dynamic_content_output', $content, $attributes, $block ); -
apply_filters( 'generateblocks_dynamic_content_post_meta', $value, self::get_source_id( $attributes ), $attributes ); -
apply_filters( 'generateblocks_dynamic_css_blocks', [ 'text' => 'GenerateBlocks_Block_Text', 'element' => 'GenerateBlocks_Block_Element', 'media' => 'GenerateBlocks_Block_Media', 'shape' => 'GenerateBlocks_Block_Shape', 'query' => 'GenerateBlocks_Block_Query', 'looper' => 'GenerateBlocks_Block_Looper', 'query-page-numbers' => 'GenerateBlocks_Block_Query_Page_Numbers', 'loop-item' => 'GenerateBlocks_Block_Loop_Item', ] ); -
apply_filters( 'generateblocks_dynamic_css_priority', 25 ); -
apply_filters( 'generateblocks_dynamic_headline_allowed_tagnames', array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'p', 'figcaption', ), $attributes, $block ); -
apply_filters( 'generateblocks_dynamic_headline_tagname', $settings['element'], $attributes, $block ); -
apply_filters( 'generateblocks_dynamic_image_fallback', '', $attributes, $block ); -
apply_filters( 'generateblocks_dynamic_source_id', $id, $attributes ); -
apply_filters( 'generateblocks_dynamic_tag_output', $output, $options, $raw_output ); -
apply_filters( 'generateblocks_dynamic_tags_allowed_blocks', [ 'generateblocks/element', 'generateblocks/loop-item', 'generateblocks/looper', 'generateblocks/media', 'generateblocks/query', 'generateblocks/query-page-numbers', 'generateblocks/shape', 'generateblocks/text', ] ); -
apply_filters( 'generateblocks_dynamic_tags_allowed_html', $tags, $context ); -
apply_filters( 'generateblocks_dynamic_tags_preview', true ); -
apply_filters( 'generateblocks_dynamic_url_author_meta', $url, $author_id, $attributes ); -
apply_filters( 'generateblocks_dynamic_url_output', $url, $attributes, $block ); -
apply_filters( 'generateblocks_dynamic_url_post_meta', $url, self::get_source_id( $attributes ), $attributes ); -
apply_filters( 'generateblocks_force_v1_pattern_library', false ); -
apply_filters( 'generateblocks_get_meta_object', $meta, $id, $key, $callable ); -
apply_filters( 'generateblocks_global_container_width', generateblocks_use_customizer_container_width() ? generate_get_option( 'container_width' ) . 'px' : generateblocks_get_option( 'container_width' ) . 'px' ); -
apply_filters( 'generateblocks_google_font_args', array( 'family' => implode( '|', $data ), 'subset' => null, 'display' => 'swap', ) ); -
apply_filters( 'generateblocks_google_font_variants', $variants, $font['name'] ); -
apply_filters( 'generateblocks_google_fonts', $fonts ); -
apply_filters( 'generateblocks_gp_default_styling', array( 'buttonBackground' => $color_settings['form_button_background_color'], 'buttonBackgroundHover' => $color_settings['form_button_background_color_hover'], 'buttonText' => $color_settings['form_button_text_color'], 'buttonTextHover' => $color_settings['form_button_text_color_hover'], 'buttonPaddingTop' => '10px', 'buttonPaddingRight' => '20px', 'buttonPaddingBottom' => '10px', 'buttonPaddin... ); -
apply_filters( 'generateblocks_headline_selector_tagname', true, $attributes ); -
apply_filters( 'generateblocks_inside_container', $output, $attributes, $block ); -
apply_filters( 'generateblocks_media_query', array( 'desktop' => '(min-width: 1025px)', 'desktop_tablet' => '(min-width: 768px)', 'tablet_only' => '(max-width: 1024px) and (min-width: 768px)', 'tablet' => '(max-width: 1024px)', 'mobile' => '(max-width: 767px)', ) ); -
apply_filters( 'generateblocks_modify_block_data', $data, $block ); -
apply_filters( 'generateblocks_option_defaults', array( 'container_width' => 1100, 'sync_responsive_previews' => true, 'disable_google_fonts' => true, ) ); -
apply_filters( 'generateblocks_option_sanitize_callbacks', array( 'container_width' => 'absint', 'sync_responsive_previews' => 'rest_sanitize_boolean', 'disable_google_fonts' => 'rest_sanitize_boolean', 'gb_use_v1_blocks' => 'rest_sanitize_boolean', ) ); -
apply_filters( 'generateblocks_pattern_libraries', $remote_libraries ); -
do_action( 'generateblocks_process_block_css', [ 'block_short_name' => $name, 'attributes' => $attributes, 'current_filter' => current_filter(), ] ); -
apply_filters( 'generateblocks_query_loop_editor_posts_cap', $default ); -
apply_filters( 'generateblocks_safe_user_meta_keys', $safe_keys ); -
do_action( 'generateblocks_settings_area' ); -
apply_filters( 'generateblocks_should_set_container_width', true ); -
apply_filters( 'generateblocks_svg_shapes', array( 'gb-waves' => array( 'group' => esc_attr__( 'Waves', 'generateblocks' ), 'svgs' => array( 'gb-waves-1' => array( 'label' => sprintf( __( 'Wave %s', 'generateblocks' ), '1' ), 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 194.3" preserveAspectRatio="none"><path d="M1200 133.3l-50 8.9c-50 8.6-150 26.9-250 31.1-100 4.2-200-4.2-300-26.7S400 89.2 300 62.2C200 35.8 100 1... ); -
apply_filters( 'generateblocks_typography_font_family_list', [ [ 'label' => __( 'System Fonts', 'generateblocks' ), 'options' => [ [ 'value' => 'Arial', 'label' => 'Arial', ], [ 'value' => 'Helvetica', 'label' => 'Helvetica', ], [ 'value' => 'Times New Roman', 'label' => 'Times New Roman', ], [ 'value' => 'Georgia', 'label' => 'Georgia', ], ], ], ] ); -
apply_filters( 'generateblocks_use_block_defaults_cache', false ); -
apply_filters( 'generateblocks_use_customizer_container_width', true ); -
apply_filters( 'generateblocks_use_v1_blocks', $option ); -
apply_filters( 'generateblocks_use_visited_selector', $use_visited_selector, $name, $attributes ); -
apply_filters( "term_links-{$taxonomy}", $list_items );
Generated from GenerateBlocks'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: