Title: contentPreRender function conflict with theme.json
Last modified: February 10, 2023

---

# contentPreRender function conflict with theme.json

 *  Resolved [rynokins](https://wordpress.org/support/users/rynokins/)
 * (@rynokins)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/contentprerender-function-conflict-with-theme-json/)
 * Hello, I discovered an issue with your `**contentPreRender($block)**` `(Function
   to load assets for post/page on front-end before gutenberg rendering)`. The function
   does not play well with block attributes defined by `theme.json` files.
 * The problem is that when you filter blocks that are not being styled by your 
   plugin, you only use the `['innerContent']` portion of the block data. (See line#
   3580 of `advanced-gutenberg-main.php` – `array_push($block['innerContent'], $
   style);`)
 * So when one attempts to use link-color settings from `theme.json` such as these:
 *     ```wp-block-code
       {
         "version": 2,
         "settings": {
           "color": {
             "link": true,
             "palette": [
               {
                 "name": "Green",
                 "slug": "green",
                 "color": "#78be20"
               }
             ]
           }
         }
       }
       ```
   
 *  – the resulting block data that is used by WordPress to link their inline style
   to the block requires the attributes portion of the data, which is not contained
   in the `innerContent`, see below for sample data (simplified for readability):
 *     ```wp-block-code
       [
         'blockName' => 'core/paragraph',
         'attrs' => [
           'style' => [
             'elements' => [
               'link' => [
                 'color' => [
                   'text' => 'var:preset|color|green',
                 ],
               ],
             ],
           ],
         ],
         'innerBlocks' => [],
         'innerHTML' => '<p class="has-link-color">This line has a link <a href="#">colored green</a>.</p>',
         'innerContent' => [
           0 => '<p class="has-link-color">This line has a link <a href="#">colored green</a>.</p>',
         ],
       ]
       ```
   
 * Hopefully there is a way to better integrate with block data outside of the `
   innerContent` – however, commenting out line #3580 seems to fix the conflict 
   for now.
 * Thank you, looking forward to see if you can fix this easily!

Viewing 1 replies (of 1 total)

 *  Plugin Author [htmgarcia](https://wordpress.org/support/users/htmgarcia/)
 * (@htmgarcia)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/contentprerender-function-conflict-with-theme-json/#post-16466166)
 * Thanks for your detailed feedback, [@rynokins](https://wordpress.org/support/users/rynokins/)!
 * We opened an issue in Github: [https://github.com/publishpress/PublishPress-Blocks/issues/1239](https://github.com/publishpress/PublishPress-Blocks/issues/1239)
 * Regards

Viewing 1 replies (of 1 total)

The topic ‘contentPreRender function conflict with theme.json’ is closed to new 
replies.

 * ![](https://ps.w.org/advanced-gutenberg/assets/icon-256x256.png?rev=3393761)
 * [PublishPress Blocks - Block Controls, Block Visibility, Block Permissions](https://wordpress.org/plugins/advanced-gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-gutenberg/reviews/)

## Tags

 * [conflict](https://wordpress.org/support/topic-tag/conflict/)
 * [theme.json](https://wordpress.org/support/topic-tag/theme-json/)

 * 1 reply
 * 2 participants
 * Last reply from: [htmgarcia](https://wordpress.org/support/users/htmgarcia/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/contentprerender-function-conflict-with-theme-json/#post-16466166)
 * Status: resolved