Skip to content

Instantly share code, notes, and snippets.

@dexit
Forked from pingram3541/function.php
Created July 25, 2025 10:20
Show Gist options
  • Save dexit/ce0174045bbfeda4703564e5bb14553b to your computer and use it in GitHub Desktop.
Save dexit/ce0174045bbfeda4703564e5bb14553b to your computer and use it in GitHub Desktop.
Add disclaimer notice after all Elementor HTML widgets that use id 'html_notice'
<?php
add_action( 'elementor/widget/render_content', function( $content, $widget ) {
if ( 'html' === $widget->get_name() ) {
$settings = $widget->get_settings(); //contains all widget settings - read-only!
//checks if special id exists
if ( ! empty( $settings['_element_id'] ) && $settings['_element_id'] === 'html_notice' ) {
$content .= '<div class="disclaimer_notice"><span>Copy and use of the above code is at your own risk.</span></div>';
}
}
return $content;
}, 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment