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:
- How to override existing plugin action with new action
- Which hook should be used to add an action containing a redirect?
- WordPress Update Plugin Hook/Action? Since 3.9
- Custom action button in Gutenberg editor (post_submitbox_misc_actions – equivalent)
- add_action with a class method is causing fatal errors
- Do I need to call do_action in my plugin?
- How Do I Load My Action Earlier Enough?
- Which to use to execute code during the saving of a plugin settings page?
- How do I Make a Theme “plugin-ready”?
- A Post is saved twice or more during add_action(save_post)
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Create Element From Dynamic HTML String [closed]
- Is it possible to create an action hook using do_action() within add_action()?
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- When is it too late to call the action wp_enqueue_scripts?
- Odd behaviour with submenu link creation
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- What is the Difference between directly call a function and call a function using add_action?
- Looking for callback function after Gutenberg is rendered?
- How to Parse an Array of Elements in Gutenberg Block
- Create a plugin to change the action to which a function is hooked
- Is there a better way to implement responsive images than what WordPress uses by default?
- Gutenberg registerFormatType with Multiple Classes
- Gutenberg Block add element in the Editor inside InnerBlocks after div – editor-block-list
- Gutenberg – What is the best way to save/update post meta?
- admin_notices not displaying in plugin
- How do you render_callback for register_block_type to a method in another class?
- How to create multiple Gutenberg blocks in one plugin
- How to get color name in PanelColorSettings in custom Gutenberg block?
- Getting admin notices working for plugin errors
- Which are the hooks run before/after when a category’s deletion?
- An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”
- Namespaced action and filter tags
- WordPress Block Development – trouble importing from @wordpress/icons
- Is there an additional block.json property to set to get an InnerBlocks child to respect the “supports” property?
- How to setAttributes in Gutenberg block?
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Adding rewrite rule dynamically
- How to access noticeOperations from withNotices
- How to prevent UNDO on guternberg block editor
- How to insert text at the current cursor position in Gutenberg?
- How to override gutenberg paragraph block edit property
- Do I have to worry about useState causing a re-render?
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- Creating a custom Gutenberg block with columns
- How to get boolean value from register_meta properly?
- How can I get the selected string when using a toolbar button in Gutenberg?
- jQuery selectors for editor elements safe to use?
- wp_set_object_terms not updating database without a die()
- There is a problem in the gutenberg block I developed. Problem is with withInstanceId
- Show error message after exception handled
- I have 2 plugins using the same wp_login action hook and one is not working
- 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?
- Bug: Post needs to be updated twice when adding action for save_post hook
- How to only load css for used blocks on frontend
- Delete data from database using row action
- 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
- Proper way to use useSelect
- Call to undefined function is_home() or any conditional tags
- How to save post meta as an array in Gutenberg?
- Developing the save function in Gutenberg blocks
- WordPress Gutenberg InnerBlocks renderAppender not showing with template
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- Adding tables to dashboard pages programmatically?
- Setting post_id for single.php based on URL without a redirect
- Console errors in 6.0-RC1 Widget screen
- How to override supports of innerBlocks?
- How to use attributes in competent of Gutenberg
- Action / Hook when a new plugin is added
- 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?
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- 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 use setAttributes outside of the edit function return
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Reading plugin settings in esnext wordpress block
- Post is uncatagorized in publish_post action
- How to get access the ID of all posts of custom post type in Gutenberg editor
- remove different admin menu for specific users
- WordPress Reset password Strength set to medium
- 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
- How can I include React useState in a custom gutenberg block plugin?
- Remove Gutenberg Buttons Block