I need to change the content of specific Gutenberg blocks dynamically based on the logged-in user’s role (admin, editor, subscriber) without modifying theme files.
I’ve tried using register_block_type and editor.BlockEdit, but I can’t figure out how to filter block content before it’s rendered in both the editor and frontend.
What’s the best way to achieve this via a plugin or functions.php?
I tried using register_block_type and editor.BlockEdit to change Gutenberg block content based on user roles. Expected it to update dynamically for admins, editors, and subscribers in both the editor and frontend. But it only worked on the frontend, not inside the editor. Looking for a way to make it update in both places.