Controller::disable_blocks_on_display( string $content )
Disables the Blocks Editor on posts that have been edited with Elementor.
Contents
By filtering them out of the post content on display.
Parameters
- $content
-
(string) (Required) The post content.
Return
(string) The modified post content.
Source
File: src/Events/Integrations/Plugins/Elementor/Controller.php
public function disable_blocks_on_display( $content ): string {
global $post;
// Not a post.
if ( ! $post instanceof WP_Post ) {
return $content;
}
// Not an event.
if ( ! tribe_is_event( $post ) ) {
return $content;
}
if (
// Not an event edited with Elementor.
// Or one having an Elementor template applied.
! tribe( Template_Controller::class )->is_override()
) {
return $content;
}
// Remove TEC blocks when displayed in an elementor widget.
return preg_replace(
'/<!-- wp:tribe.*-->/miU',
'',
$content
);
}
Changelog
| Version | Description |
|---|---|
| 6.4.0 | Introduced. |