I have a WordPress site with an iframe that displays custom content from an external site.

Here is my iframe code:

<iframe src="https://www.targetsite.com/UNIQUECODE" width="800" height="800">

I want the "UNIQUECODE" in the iframe to populate based on the browser URL (my site is example.com):


Is this possible with the WordPress block editor and/or with an update to functions.php?

  • Yes of course. How are you generating the iframe mark-up? Just typing the HTML into a block, from PHP in a template, something else?
    – Rup
    Commented Aug 31, 2021 at 0:42
  • Just typing it into a block right now...
    – jvchappy
    Commented Aug 31, 2021 at 3:06


Your Answer

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

Browse other questions tagged or ask your own question.