Fix: Store Notices block breaks page editors (https://github.com/woocommerce/woocommerce-blocks/pull/11165)
This commit is contained in:
parent
df2a3d72d2
commit
1f049de16b
|
@ -26,6 +26,17 @@ class StoreNotices extends AbstractBlock {
|
|||
* @return string | void Rendered block output.
|
||||
*/
|
||||
protected function render( $attributes, $content, $block ) {
|
||||
/**
|
||||
* This block should be rendered only on the frontend. Woo loads notice
|
||||
* functions on the front end requests only. So it's safe and handy to
|
||||
* check for the print notice function existence to short circuit the
|
||||
* render process on the admin side.
|
||||
* See WooCommerce::is_request() for the frontend request definition.
|
||||
*/
|
||||
if ( ! function_exists( 'wc_print_notices' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
woocommerce_output_all_notices();
|
||||
$notices = ob_get_clean();
|
||||
|
|
Loading…
Reference in New Issue