Hello @chrisosaur
Hope you’re doing well today! Thank you for reaching out to us.
By default, the HTML field in Forminator filters out the “iframe” and “script” tags for security reasons, hence when iframe is added to the HTML field it won’t work directly.
However, you can add the snippet below to help render the iframe within the form.
<?php
if ( ! function_exists( 'wpmudev_forminator_enable_iframe' ) ) {
function wpmudev_forminator_enable_iframe() {
$form_exists = has_shortcode( get_the_content(), 'forminator_form' );
if ( $form_exists ) {
?>
<script type="text/javascript">
(($, d) => {
$(d).ready(function() {
$("#forminator-module-33 #html-1").html('YOUR_IFRAME_GOES_HERE');
});
})(jQuery, document);
</script>
<?php
}
}
add_action( 'wp_footer', 'wpmudev_forminator_enable_iframe', 9999 );
}
?>
You will need to use the custom snippet as a mu-plugin and upload it to the /wp-content/mu-plugins/ directory.
Below are the steps on how you can use it:
1. You will need to create a new php file and paste the snippet there, the name of the file can be anything (for example: forminator-allow-html.php)
2. On the line
$("#forminator-module-33 #html-1")
Please update the “33” with your form ID, the form ID is the number that you see on the form shortcode. Further, “#html-1” is the field ID of the HTML field. This will define where the iframe will be rendered. (you need to leave the “html-1” field blank on the form)
3. On the line YOUR_IFRAME_GOES_HERE
Here, you need to replace the text with the actual iframe SRC of your Google Calendar and save the changes.
4. Lastly, upload the snippet as a mu-plugin by navigating to the /wp-content/mu-plugins/ directory and that’s it. Here is a guide about using mu-plugins: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
After the snippet is uploaded, it should render the Google Calendar via “iframe” within the form on the frontend.
Hope this helps.
Kind Regards,
Saurabh