External Site Embedding (iframe / JavaScript)
English version coming soon
This page has not been translated to English yet. Please refer to the Japanese version for full details.
Form Plant forms can be embedded outside WordPress using an iframe or JavaScript snippet, useful for landing pages or sites on a different domain.
iframe vs JavaScript
| Method | Pros | Best For |
|---|---|---|
| iframe | Simplest. Fully isolated form. | Static HTML sites |
| JavaScript | Easier to blend with parent design. | LPs / web apps |
Enable Embedding
External embedding is off by default per form. To enable:
- Open Form Plant → (your form) → Form Settings → External Use
- Check Allow iframe embedding or Allow JavaScript embedding
- Add allowed domains in Allowed Site URLs (one per line)
- Save
Embeds from non-allowed domains are blocked.
iframe Snippet
<iframe
src="https://{your-site}/wpfplant-embed/{form_id}/"
width="100%"
height="800"
frameborder="0"
style="border: none;"
></iframe>
JavaScript Snippet
<div id="fplant-form-container"></div>
<script
src="https://{your-site}/wp-content/plugins/form-plant/public/embed.js"
data-form-id="{form_id}"
data-target="#fplant-form-container"
></script>
Local Testing
Use the bundled external-site/ test container (Docker Compose external-site service):
- External test site: http://localhost:8083/
- iframe test: http://localhost:8083/iframe-test.php
- JavaScript embed test: http://localhost:8083/js-embed-test.php
Add http://localhost:8083 to the allowed sites before testing.