Controller::built_with_elementor( int $post_id = null )
Checks if the post was edited with Elementor.
Contents
Parameters
- $post_id
-
(int) (Optional) The post ID.
Default value: null
Return
(bool)
Source
File: src/Events/Integrations/Plugins/Elementor/Controller.php
public function built_with_elementor( $post_id = null ): bool {
if ( ! $post_id ) {
$post_id = tribe_get_request_var( 'post' );
}
// Handle previews.
if ( ! $post_id ) {
$post_id = tribe_get_request_var( 'preview_id' );
}
// We can't get the post ID, bail out.
if ( ! $post_id ) {
return false;
}
// Not an event, bail out.
if ( ! tribe_is_event( $post_id ) ) {
return false;
}
$elementor_edit = get_post_meta( $post_id, Document::BUILT_WITH_ELEMENTOR_META_KEY, true );
/**
* Filters whether the post was built with Elementor.
*
* Specifically only filtering for Events and takes in consideration if we are looking at a preview request
* and uses the same meta as Elementor itself to check, see `Document::BUILT_WITH_ELEMENTOR_META_KEY`.
*
* @since 6.4.0
*
* @param bool $elementor_edit Whether the post was built with Elementor.
* @param int $post_id The post ID.
*/
return apply_filters( 'tec_events_elementor_built_with_elementor', $elementor_edit, $post_id );
}
Changelog
| Version | Description |
|---|---|
| 6.4.0 | Introduced. |