Title: Block Plugin Doesn&#8217;t work With Theme &gt;= 2022
Last modified: December 9, 2022

---

# Block Plugin Doesn’t work With Theme >= 2022

 *  Resolved [George Sexton](https://wordpress.org/support/users/gsexton/)
 * (@gsexton)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/)
 * I have a plugin, and it supports Gutenberg blocks. I’m using WordPress 6.1.1 
   On OpenSUSE with PHP 7.4.25. The plugin does work as expected with the 2021 theme.
   I can insert the block with the 2022 theme, and the block insertion/edit works
   as expected.
 * However, when viewing the page, the block doesn’t render.
 * I’ve poked around, and it looks like the block naming convention may have changed.
   Looking through my code, I have a fully qualified block prefix of: “plugin-name-
   gblock”. The code editor shows a block name of “plugin-name/gblock”.
 * Is this a known change? Can you give me any information about what happened and
   how I should remediate things?
 * Thanks!
 * George

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [George Sexton](https://wordpress.org/support/users/gsexton/)
 * (@gsexton)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16277685)
 * I looked at this a little more closely. I am calling register_block_type() with
   the same naming format that I see the block name in the editor. The return value
   of register_block_type() is shown below.
 * What’s happening is the render callback isn’t getting hit. Again, with the WP
   2021 theme, it works, with 2022/2023 it doesn’t. The render callback argument
   for register_block_type() is:
 * `'render_callback' => array($this, 'renderGutenberg')`
 *     ```
       Class Name= WP_Block_Type Data= {
           "api_version": 1,
           "name": "pluginname/gblock",
           "title": "",
           "category": null,
           "parent": null,
           "ancestor": null,
           "icon": null,
           "description": "",
           "keywords": [],
           "textdomain": null,
           "styles": [],
           "variations": [],
           "supports": null,
           "example": null,
           "render_callback": [
               {},
               "renderGutenberg"
           ],
           "attributes": {
               "lock": {
                   "type": "object"
               }
           },
           "uses_context": [],
           "provides_context": null,
           "editor_script_handles": [
               "pluginname-gblock-editor"
           ],
           "script_handles": [],
           "view_script_handles": [],
           "editor_style_handles": [
               "pluginname-gblock-editor"
           ],
           "style_handles": [
               "pluginname-gblock"
           ]
       }
       ```
   
    -  This reply was modified 3 years, 6 months ago by [George Sexton](https://wordpress.org/support/users/gsexton/).
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16282388)
 * Hi [@gsexton](https://wordpress.org/support/users/gsexton/) – I asked a developer
   to take a look at this for you, but they’d like to see the full plugin to be 
   able to troubleshoot further. Could you please provide a link to your complete
   plugin, either in the WordPress.org repository, on GitHub, or elsewhere. Thanks!
 *  Thread Starter [George Sexton](https://wordpress.org/support/users/gsexton/)
 * (@gsexton)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16282626)
 * [@zoonini](https://wordpress.org/support/users/zoonini/) Thanks for checking.
   The plugin is at:
 * [https://wordpress.org/plugins/connect-daily-web-calendar/](https://wordpress.org/plugins/connect-daily-web-calendar/)
 * The register_block_type() is in class-cdaily-wordpress-plugin.php around line
   100.
 *  [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16285515)
 * Hi there!
 * I dug into the code a bit and believe I have found the issue. The `initGutenberg`
   function which registers the block is being called in `addPluginStylesheet` which
   is being run on the `wp_enqueue_script` hook.
 * I believe this hook is run too late for it to work on the front end. I move the`
   register_block_type` call out of the hook and into the main plugin PHP file and
   it displayed correctly on the front end.
 * Please keep in mind that this is a very complicated plugin and I have only taken
   a cursory look but that is where I would start
 * Hope this helps!
    -  This reply was modified 3 years, 6 months ago by [Ryan Welcher](https://wordpress.org/support/users/welcher/).
 *  Thread Starter [George Sexton](https://wordpress.org/support/users/gsexton/)
 * (@gsexton)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16297561)
 * [@welcher](https://wordpress.org/support/users/welcher/) Thanks so much for looking
   into this. Your assessment was correct. I restructured the code so that the block
   type is registered in the startup code and that resolved the problem.
    -  This reply was modified 3 years, 5 months ago by [George Sexton](https://wordpress.org/support/users/gsexton/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Block Plugin Doesn’t work With Theme >= 2022’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentytwentytwo/2.1/screenshot.
   png)
 * Twenty Twenty-Two
 * [Support Threads](https://wordpress.org/support/theme/twentytwentytwo/)
 * [Active Topics](https://wordpress.org/support/theme/twentytwentytwo/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentytwentytwo/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentytwentytwo/reviews/)

## Tags

 * [gutenberg](https://wordpress.org/support/topic-tag/gutenberg/)

 * 5 replies
 * 3 participants
 * Last reply from: [George Sexton](https://wordpress.org/support/users/gsexton/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/block-plugin-doesnt-work-with-theme-2022/#post-16297561)
 * Status: resolved