Add a FormBharat Form to WordPress
You can show any FormBharat form on a WordPress page or post with a small piece of embed code. It works with the block editor, the classic editor, and page builders like Elementor.
Before you start
- 1Open your form in FormBharat and go to Share
- 2Copy your form link. It looks like
https://formbharat.com/f/YOUR_FORM_ID - 3Make sure the form is published
Option 1: Show the form on the page
- 1Edit the page or post in WordPress
- 2Add a Custom HTML block (in Elementor, use the HTML widget; in the classic editor, switch to the Text tab)
- 3Paste this code and replace
YOUR_FORM_IDwith your form ID:
<iframe id="formbharat-form" src="https://formbharat.com/f/YOUR_FORM_ID?fb_src=wordpress" width="100%" height="700" style="border:0;max-width:100%;" loading="lazy" title="Form"></iframe>
<script>
window.addEventListener('message', function (e) {
var f = document.getElementById('formbharat-form');
if (!f || e.source !== f.contentWindow || e.origin !== 'https://formbharat.com') return;
if (e.data && e.data.type === 'formbharat:height') f.style.height = e.data.height + 'px';
});
</script>
- 4Update the page
The small script grows the frame to fit your form, so visitors do not get a scrollbar inside the form. If your site blocks scripts in the page, the form still works at the fixed height. Raise height if the form is cut off.
Option 2: A button that opens the form in a popup
Paste this in a Custom HTML block instead:
<script src="https://formbharat.com/widget.js" data-form-id="YOUR_FORM_ID" data-source="wordpress" data-button-text="Contact us" data-position="inline" async></script>
Use data-position="bottom-right" for a floating button in the corner of every page where you place the code.
Troubleshooting
The form is blank or shows a blocked message. Some security or caching plugins block iframes. Allow formbharat.com in the plugin's settings. WordPress.com plans below Business may not allow custom HTML at all.
The form is cut off on mobile. Increase the height value, or make sure the small script above was pasted along with the iframe.
Responses are not arriving. Responses are stored in FormBharat, not in WordPress. Open your form's Responses tab. To also get an email or webhook for each response, see Email Notifications and Setting Up Webhooks.
About your visitors' data
When someone views the page, their browser loads the form from formbharat.com, and what they type is sent to and stored by FormBharat. See our Privacy Policy.