Title: PHP code into iframe url
Last modified: August 21, 2016

---

# PHP code into iframe url

 *  Resolved [andrezasv](https://wordpress.org/support/users/andrezasv/)
 * (@andrezasv)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/php-code-into-iframe-url/)
 * Hi,
 * The URL of my iframe is dynamically defined through a PHP code. For instance,
   to show in the iframe the list of pages of a given site in a multisite I do: [
   php_code_to_get_the_full_url_of_my_site]/wp-admin/edit.php?post_type=page
 * Can I insert PHP code in the iframe url field?
 * [https://wordpress.org/plugins/advanced-iframe/](https://wordpress.org/plugins/advanced-iframe/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [mdempfle](https://wordpress.org/support/users/mdempfle/)
 * (@mdempfle)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4876950)
 * No. But adding this by yourself should not be a big problem. The src can be set
   e.g. by a parameter to url mapping in the pro version. Maybe this already solves
   your problem…
 * Below you find the description of the filed I mean:
 * Map parameter to url
    You can map an url parameter value pair to an url or pass
   the url directly which should be opened in the iframe. If you e.g. have a page
   with the iframe and you like to have different content in the iframe depending
   on an url parameter than this is the setting you have to use. You have to specify
   this setting in the following syntax “parameter|value|url” e.g. “show|1|http://
   www.tinywebgallery.com”. If you than open the parent page with ?show=1 than [http://www.tinywebgallery.com](http://www.tinywebgallery.com)
   is opened inside the iframe. You can also specify several mappings by separating
   them by ‘,’. You can also only specify 1 parameter here! The value of this paramter
   is than used as iframe url. e.g. show=http%3A%2F%2Fwww.tinywebgallery.com%3Fparam
   =value. You need to encode the url if you pass it in the url. Especially ? (%
   3F) and & (%26)! Please note that because of security reason only whitelisted
   chars [a-zA-Z0-9/:?&.] are allowed. Encoded parameters in the passed urls are
   not supported because all input is decoded and checked. If no parameter/value
   pair does match the normal src attribute of the configuration is used. Shortcode
   attribute: map_parameter_to_url=””
 * Best, Michael
 *  Thread Starter [andrezasv](https://wordpress.org/support/users/andrezasv/)
 * (@andrezasv)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877109)
 * Sorry, but I could not understand where I have to isnert the php code (echo site_url();)
   to obtain the full url of my site. I’m doing this because I have a multisite 
   instalation.
 * Remember I cannot define the URL statically, but only with the function site_url();
 * Is it possible? How?
 *  Plugin Author [mdempfle](https://wordpress.org/support/users/mdempfle/)
 * (@mdempfle)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877111)
 * If you have to use site_url() you have to go into the code.
 * Look for the place where the <iframe is written. The src value is one of the 
   first ones you have to extend/replace then.
 * Best, Michael
 *  Thread Starter [andrezasv](https://wordpress.org/support/users/andrezasv/)
 * (@andrezasv)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877112)
 * So, is it possible?
 *  Plugin Author [mdempfle](https://wordpress.org/support/users/mdempfle/)
 * (@mdempfle)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877113)
 * sure.
 * as I have written.
 * Search for <iframe in advanced-iframe
 * there you find
    $html .= ” src='” . $src . “‘ “;
 * Simply set $src to what you want…
 * Best, Michael
 *  Thread Starter [andrezasv](https://wordpress.org/support/users/andrezasv/)
 * (@andrezasv)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877118)
 * If I modify the $src in the code it will be applied to all iframes. I have several
   iframes, for instance, to open the pages and the posts of the subsites. So, if
   I’m in the subsite A, the src would be: . And if I’m in the subsite B, the src
   would be:
 * So, I cant define the src in the code. I want to use your plugin, it is very 
   helpful. Tell me other ways to dynamically set the src, it would be nice if it
   accept shortcodes.
 *  Plugin Author [mdempfle](https://wordpress.org/support/users/mdempfle/)
 * (@mdempfle)
 * [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877119)
 * I thought you only want to define the first part of it. And than the rest in 
   the src attribute. So that this will be put together.
    It this not what you need.
   Which shortcode plugin would you use? Extending the plugin that this be possible
   is also a way. But than I would need how this should look like.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP code into iframe url’ is closed to new replies.

 * ![](https://ps.w.org/advanced-iframe/assets/icon-128x128.png?rev=1028488)
 * [Advanced iFrame](https://wordpress.org/plugins/advanced-iframe/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-iframe/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-iframe/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-iframe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-iframe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-iframe/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [mdempfle](https://wordpress.org/support/users/mdempfle/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/php-code-into-iframe-url/#post-4877119)
 * Status: resolved