Support

Account

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 width and 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!