bogo.currentPost is undefined in Block Editor
-
Hi Takayuki and Bogo team,
I am reporting an issue with Bogo in the Gutenberg block editor that causes a fatal JavaScript error and breaks third-party block plugins (such as Spectra / Ultimate Addons for Gutenberg).
I’m working on a website di wordpress studio in local ( but i also test it in an online website) with wordpress default theme 2023
Browser: Firefox
WordPress studio
WordPress versione 7.0.2
windows 11Issue Description: When opening the page/post editor, Bogo fails to define
bogo.currentPostbefore executingbogo/includes/block-editor/language-panel/index.js. This triggers the following console error:Uncaught TypeError: can't access property "lang", bogo.currentPost is undefinedBecause this is an uncaught JS error, it immediately halts the browser’s JavaScript execution thread, preventing subsequent block scripts (like Spectra) from rendering their controls in the editor.
Console Trace:
Plaintext
Uncaught TypeError: can't access property "lang", bogo.currentPost is undefined http://localhost:8881/wp-content/plugins/bogo/includes/block-editor/language-panel/index.js?ver=3.9.2:2Temporary Workaround: Injecting a fallback object via PHP resolves the issue without breaking Bogo’s core functionality:
PHP
add_action('enqueue_block_editor_assets', function() { $bogo_fix = 'window.bogo = window.bogo || {}; window.bogo.currentPost = window.bogo.currentPost || { lang: "" };'; wp_add_inline_script('wp-editor', $bogo_fix, 'before'); }, 1);
hope this feedback may help
best regards
You must be logged in to reply to this topic.