Controller::action_elementor_document_after_save( ElementorCoreDocumentTypesPost $document, array $editor_data )
Test function to re-save the metadata as the base post in a series.
Contents
This is a temporary solution to fix the issue with the Elementor data not being saved on the real post. It’s NOT WORKING CORRECTLY as of yet, and the issue is still being investigated.
Parameters
- $document
-
(ElementorCoreDocumentTypesPost) (Required) The document.
- $editor_data
-
(array) (Required) The editor data.
Source
File: src/Events/Integrations/Plugins/Elementor/Controller.php
public function action_elementor_document_after_save( $document, $editor_data ): void {
if ( empty( $document ) ) {
return;
}
$occurrence_id = $document->get_main_id();
$event = tribe_get_event( $occurrence_id );
// This is an occurrence the real post ID is hold as a reference on the occurrence table.
if ( empty( $event->_tec_occurrence->post_id ) || ! $event->_tec_occurrence instanceof Occurrence ) {
return;
}
$saved_meta = get_post_meta( $occurrence_id, '_elementor_data', true );
$real_id = $event->_tec_occurrence->post_id;
// Don't use `update_post_meta` that can't handle `revision` post type.
$is_meta_updated = update_metadata( 'post', $real_id, '_elementor_data', $saved_meta );
}
Changelog
| Version | Description |
|---|---|
| 6.4.0 | Introduced. |