JavaScript error in admin when Gutenberg is disabled
-
I’m encountering a JavaScript error in the WordPress admin area that appears to be related to WPForms when the Block Editor (Gutenberg) is disabled.
Environment
- WordPress version: 6.9.1
- WPForms version: 1.9.9.2
- Gutenberg disabled using:
add_filter( 'use_block_editor_for_post', '__return_false' );
add_filter( 'use_widgets_block_editor', '__return_false' );On the following admin screens:
- /wp-admin/edit.php (posts list)
- /wp-admin/post.php
- /wp-admin/post-new.php
the browser console shows this error:
TypeError: Cannot read properties of undefined (reading 'getEditedPostAttribute')
at Object.getEditorTitle
at Object.maybeShowGutenbergNotice
in wpforms/assets/js/admin/education/edit-post.es5.min.jsFrom what I can see, the script
wpforms/assets/js/admin/education/edit-post.es5.min.js
assumes the presence of the Gutenberg data store:
wp.data.select('core/editor').getEditedPostAttribute(...)However, when Gutenberg is disabled, core/editor is not registered, so wp.data.select(‘core/editor’) returns undefined, which causes the exception.
Expected behavior
The script should either:
- Only be enqueued when the Block Editor is active, or
- Gracefully check for the existence of wp.data.select(‘core/editor’) before calling getEditedPostAttribute.
Temporary workaround
I resolved the issue locally by dequeuing this specific WPForms “education/edit-post” script on edit.php and post.php screens when Gutenberg is disabled, but this is only a workaround.
I wanted to report this in case it’s an unintended enqueue condition in WPForms.
Let me know if you need system info or additional details.
You must be logged in to reply to this topic.