epl_elementor_restore_archive_conditions: let Archive template conditions be cleared
Description #
Elementor can wipe an Archive template's display conditions while you switch it to or from a Loop Item in the editor. To protect against that, EPL keeps a copy of the conditions of every Elementor Pro Theme Builder Archive template each time they're saved. If a request leaves an Archive template with no conditions, EPL puts the saved copy back when the request ends.
This applies to every Archive template, not only ones built with EPL widgets, and also when you remove all conditions on purpose. Return false to leave the conditions empty.
Part of the Elementor integration, which is in beta. See Elementor widgets and templates (beta) for how the widgets and templates fit together.
Usage #
add_filter( 'epl_elementor_restore_archive_conditions', 'my_function', 10, 3 );
Parameters #
$restore (bool)
True to put the saved conditions back. Default true.
$post_id (int)
The Archive template's ID.
$backup (array)
The saved conditions EPL would restore.
Examples #
Let template 789 keep an empty set of conditions:
function my_epl_allow_empty_conditions( $restore, $post_id, $backup ) {
if ( 789 === $post_id ) {
return false;
}
return $restore;
}
add_filter( 'epl_elementor_restore_archive_conditions', 'my_epl_allow_empty_conditions', 10, 3 );
Never restore conditions:
add_filter( 'epl_elementor_restore_archive_conditions', '__return_false' );
Source #
lib/page-builders/elementor/class-epl-elementor.php, in EPL_Elementor::restore_archive_conditions(), which runs on shutdown. The copy is kept by EPL_Elementor::track_archive_conditions(). Since 3.6.