Home › Forums › ACF PRO › Best Option for iFrame Embed › Reply To: Best Option for iFrame Embed
I know this is a few months old but I came across this while searching for how to escape an iframe and wanted to share my solution. I ended up using the
url field and then outputting the iframe in my custom template. I also added two additional text fields for
height so my final code looked like this:
<?php echo ( '<iframe style="width:'. esc_attr( get_field( 'iframe_width' ) ) ."; height:" . esc_attr( get_field( 'iframe_height' ) ) . ';" src="' . esc_url( get_field( 'iframe_url' ) ) .'" frameborder="0" allowfullscreen></iframe>' ); ?>
Hope that helps!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.