Critical error on publish post to Discourse

Using the lastest discouse and WP Discourse Wordpress plugin I get the following error when attempting to publish a post to discourse:

An error of type E_ERROR was caused in line 207 of the file /www/sociocracyforall_679/public/wp-content/themes/Divi/includes/builder/feature/gutenberg/blocks/Layout.php. Error message: Uncaught ArgumentCountError: Too few arguments to function ET_GB_Block_Layout::get_the_excerpt(), 1 passed in /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php on line 303 and exactly 2 expected in /www/sociocracyforall_679/public/wp-content/themes/Divi/includes/builder/feature/gutenberg/blocks/Layout.php:207
Stack trace:
#0 /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php(303): ET_GB_Block_Layout->get_the_excerpt(‘It was yet anot…’)
#1 /www/sociocracyforall_679/public/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘It was yet anot…’, Array)
#2 /www/sociocracyforall_679/public/wp-content/plugins/wp-discourse/lib/discourse-publish.php(271): apply_filters(‘get_the_excerpt’, ‘It was yet anot…’)
#3 /www/sociocracyforall_679/public/wp-content/plugins/wp-discourse/lib/discourse-publish.php(209): WPDiscourse\DiscoursePublish\DiscoursePublish->sync_to_discourse_work(32452, ‘The day I conse…’, ’

It seems like a bug from an arguments change between versions, eh?

1 Like

Hey CJ, it looks like the error is coming from the Divi plugin or one of its extensions.

Indeed, if you google ET_GB_Block_Layout you’ll see a number of other sites have the same issue (In many cases present in the HTML being scraped by google). You should check you’re running the latest version of their plugin, and perhaps report this to Elegant Themes.

The reason the WP Discourse code appears (further down, which typically means it’s not the source of the issue) in the stack trace is because whenever you click the publish button any post-publication code will be executed, in an interconnected fashion.

If there’s any exception post-publication, whatever the source, the wp discourse plugin code is likely to appear at some point in the stack trace. It doesn’t mean it’s the source of the issue though.

And it indeed only occurs when Divi is enabled.

Hopefully they will fix it :slight_smile:

Full stack trace for reference:

ArgumentCountError: Uncaught exception 'ArgumentCountError' with message 'Too few arguments to function ET_GB_Block_Layout::get_the_excerpt(), 1 passed in /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php on line 303 and exactly 2 expected' in /www/sociocracyforall_679/public/wp-content/themes/Divi/includes/builder/feature/gutenberg/blocks/Layout.php:207
in ET_GB_Block_Layout::get_the_excerpt called at /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php (303)
in WP_Hook::apply_filters called at /www/sociocracyforall_679/public/wp-includes/plugin.php (189)
in apply_filters called at /www/sociocracyforall_679/public/wp-content/plugins/wp-discourse/lib/discourse-publish.php (271)
in WPDiscourse\DiscoursePublish\DiscoursePublish::sync_to_discourse_work called at /www/sociocracyforall_679/public/wp-content/plugins/wp-discourse/lib/discourse-publish.php (209)
in WPDiscourse\DiscoursePublish\DiscoursePublish::sync_to_discourse called at /www/sociocracyforall_679/public/wp-content/plugins/wp-discourse/lib/discourse-publish.php (158)
in WPDiscourse\DiscoursePublish\DiscoursePublish::publish_post_after_save called at /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php (305)
in WP_Hook::apply_filters called at /www/sociocracyforall_679/public/wp-includes/class-wp-hook.php (327)
in WP_Hook::do_action called at /www/sociocracyforall_679/public/wp-includes/plugin.php (470)
in do_action called at /www/sociocracyforall_679/public/wp-includes/post.php (5180)
in wp_after_insert_post called at /www/sociocracyforall_679/public/wp-includes/post.php (4482)
in wp_insert_post called at /www/sociocracyforall_679/public/wp-includes/post.php (4570)
in wp_update_post called at /www/sociocracyforall_679/public/wp-admin/includes/post.php (423)
in edit_post called at /www/sociocracyforall_679/public/wp-admin/post.php (227)
1 Like