I’m not sure that I understood exactly your goal, but check if hooking to render_block does what you want, as it will modify the block’s output before it gets rendered in the frontend. Usage example:
add_filter( 'render_block', 'my_dynamic_data', 10, 2 );
function my_dynamic_data( $block_content, $block ) {
if('my_value' === $block['attrs']['myAttribute'] ) {
// Do something
}
return $block_content;
}
Related Posts:
- Difference Between Filter and Action Hooks?
- Which action for triggering cron “wp”or “init”?
- Adding pre-publish checks with Gutenberg
- Managing two editable fields in gutenberg
- How to make repeated component/block in Gutenberg
- What’s the earliest point I can get the queried object ID?
- Using Primary Color in Plugin Block
- A Post is saved twice or more during add_action(save_post)
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- lodash dependency in a Gutenberg plugin
- Actions or filters fired when data is saved in a custom table
- add_meta_boxes action with refresh on save
- What’s the difference between hooks, filters and actions? [duplicate]
- Odd behaviour with submenu link creation
- What’s the Right Way to get and save remote data for a Gutenberg block?
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- How to redirect to action on custom page within admin section
- Gutenberg: useDispatch is not a function – @wordpress/data included
- Make a list with header and subtext in Gutenberg blocks
- Hook to get image filename when it is uploaded
- How to run an add_action hook for specific page
- Which action is triggered when a theme was modified?
- wp_transition_post_status does not change the status of the post
- Should action callbacks start with a verb?
- How insert negative values in Gutenberg box-control
- Namespaced action and filter tags
- Issue plugin commands in admin settings page
- My plugin class doesn’t work! [closed]
- Are block templates incompatible with serialize_blocks?
- How do I dynamically render an InnerBlock inside a dynamic block?
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- WordPress Block Development – trouble importing from @wordpress/icons
- add_action not calling back to function
- How to insert text at the current cursor position in Gutenberg?
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- JSX in WordPress Plugin Development
- ResizableBox with RangeControl not working
- There is a problem in the gutenberg block I developed. Problem is with withInstanceId
- load_plugin_textdomain doestn’t work with add_action plugins_loaded
- Valid filenames for add_action’s first parameter
- How to control an elements classes from multiple Gutenberg sidebar controls?
- WordPress class, using add_action to call member function does not work
- Where do I put my add_action(… and add_filter(… and do I need to remove them?
- How dynamic action login_form_{action} is working
- How to add a gradient component to a custom block
- How to only load css for used blocks on frontend
- Additional classes `undefined` after saving post in Gutenberg
- How do you submit a Gutenberg plugin?
- When does save_post hook fire on post save/update
- Invalid hook call on save, not edit when using swiper slider
- Call to undefined function is_home() or any conditional tags
- Developing the save function in Gutenberg blocks
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- wordpress automatic update does not run
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How Can I Add Code To A Preexisting Function Without Editing it
- Setting post_id for single.php based on URL without a redirect
- Modify custom block plugin without losing content
- How to override supports of innerBlocks?
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- extraprops override existing props
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- WPGut – Updating failed and shortcode?
- Gutenberg – Call google map render function in save after DOM has been rendered
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- Is “document loaded” different on admin side than public side?
- How to re-render inspector controls?
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Post is uncatagorized in publish_post action
- How to integrate plugins into block editor
- How to get access the ID of all posts of custom post type in Gutenberg editor
- How to create save function for custom Gutenberg style block?
- Does WordPress have something like timer hook?
- Apply function on all action hooks?
- How can i add insertion point between inner blocks in my custom block like core blocks
- get the queried_object of an url
- Build a dynamic block using the default attributes
- Add custom data-attribute to core Gutenberg block within an template
- Call API on post save/update and show the result in admin area
- How to replace content of a block in and re-render on change?
- extending a core block doesn’t work inside the editor
- Remove Gutenberg Buttons Block
- Insert text programmatically in WordPress Gutenberg Editor
- How to use useSelect to retrieve the currently default fontFamily?
- Event when Modal is opened/visible
- Multiple php files in dynamic gutenberg block
- How to detect when the user clicks the publish/update button in Gutenberg Editor
- Gutenberg Static blocks: viewScript doesn’t import css for frontend?
- Is It Possible to Use the Block Editor’s Notification Feature to Send Another Notification After the Post Is Saved?
- Output HTML Tags In Gutenberg Block
- Can you nest columns/column in a gutenberg custom template?
- Can we write custom DOM manipulation inside edit.js file while developing custom Gutenberg block?
- User set default settings for a Block in Site Editor
- how to include an image in the build of a multi block plugin
- render_block_context filter and block context inheritance