Title: render block &#8211; nested shortcodes
Last modified: May 27, 2024

---

# render block – nested shortcodes

 *  Resolved [hupe13](https://wordpress.org/support/users/hupe13/)
 * (@hupe13)
 * [2 years ago](https://wordpress.org/support/topic/render-block-nested-shortcodes/)
 * I show in my documentation how to use the plugins shortcodes. I work with the
   default block editor and I get annoyed every time the block is rendered incorrectly,
   because I forgot to write it in `[prismatic_code][/prismatic_code]` tags. So 
   I wrote a function that prevents this. Maybe you could include it in the plugin
   or put it in the FAQ.
 *     ```wp-block-code
       add_filter(
         'render_block',
         function ( $block_content, $block ) {
           if ( $block['blockName'] === 'prismatic/blocks' ) {
             if (strpos($block['innerHTML'], 'prismatic_code') === false) {
               return str_replace("[","&amp;#091;",$block['innerHTML']);
             }
           }
           return $block_content;
         },
         10,
         2
       );
       ```
   
 * Edit: The replaced character should be `& # 0 9 1 ;` without spaces.
    -  This topic was modified 2 years ago by [hupe13](https://wordpress.org/support/users/hupe13/).
      Reason: The second [ in str_replace should be [
    -  This topic was modified 2 years ago by [hupe13](https://wordpress.org/support/users/hupe13/).
    -  This topic was modified 2 years ago by [hupe13](https://wordpress.org/support/users/hupe13/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years ago](https://wordpress.org/support/topic/render-block-nested-shortcodes/#post-17784433)
 * Thanks [@hupe13](https://wordpress.org/support/users/hupe13/), looks very useful.
   Will definitely add to readme.txt/docs, and maybe add to the plugin as well. 
   I appreciate your sharing, thanks again.

Viewing 1 replies (of 1 total)

The topic ‘render block – nested shortcodes’ is closed to new replies.

 * ![](https://ps.w.org/prismatic/assets/icon-256x256.png?rev=1521267)
 * [Prismatic](https://wordpress.org/plugins/prismatic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prismatic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prismatic/)
 * [Active Topics](https://wordpress.org/support/plugin/prismatic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prismatic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prismatic/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/render-block-nested-shortcodes/#post-17784433)
 * Status: resolved