I am creating a plugin that has a preview, kind of like the theme customizer preview. It displays the users site in an Iframe. The issue is that I can't seem to be able to get the users homepage using the standard way of grabbing them, such as:

<iframe id="preview_frame" src="<?php get_bloginfo('url'); ?>"></iframe>


<iframe id="preview_frame" src="<?php get_home_url(); ?>"></iframe>

Can anyone shed some light on the proper way of doing this? Is their a specific way to display the site as a preview? I am using a hook to disable the admin bar in the preview, so if there is an elegant way to create a preview without the admin bar, it would be very good to know. Thanks.

1 Answer 1


You are just not using the right function. Try using this:

<iframe id="preview_frame" src="<?php echo home_url(); ?>"></iframe>

  • Thanks Jared. You were right, I was using the wrong function. I am guessing the functions I was using only work for themes, and not plugins. I am now using home_url and it works great. Jan 23, 2014 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.