Elementor is awesome but sometimes it’s not enough.
It is easy to solve Elementor problems with other Elementor addons but that just creates more complexity and cost. 🙂
Sooooo we use these simple hooks and filters to create our own solutions.
Elementor PHP Hook List -> PHP Hooks | Elementor Developers
Some Examples -> Save Editor Data | Elementor Developers
Log user activity when the user saves Elementor data
function log_saved_elementor_data( $post_id, $editor_data ) {
// Interact with your activity log plugin
insert_activity_log_data(
[
'action' => 'saved',
'object_type' => 'Elementor Data',
'object_id' => $post_id,
'object_name' => get_the_title( $post_id ),
]
);
}
add_action( 'elementor/editor/after_save', 'log_saved_elementor_data' );
Clear old cache when the user saves new Elementor data.
function clear_cache_when_updating_elementor( $post_id, $data ) {
if ( get_post_status( $post_id ) != 'publish' ) {
return;
}
// Interact with your caching plugin
clear_old_cache_data_for_your_post( $post_id );
}
add_action( 'elementor/editor/after_save', 'clear_cache_when_updating_elementor' );
Clear Elementor Cache when Elementor Activated
// Check if Elementor installed and activated
if ( did_action( 'elementor/loaded' ) ) {
// clear Elementor cache
\Elementor\Plugin::instance()->files_manager->clear_cache();
}
Clear Elementor Cache on Every Elementor Save
if ( did_action( 'elementor/editor/after_save' ) ) {
// clear Elementor cache
\Elementor\Plugin::instance()->files_manager->clear_cache();
}