How to Add Custom HTML to Your WordPress Forms

Do you want to embed custom HTML code snippets on your WordPress forms? Adding custom HTML to your form is a great way to get creative and enhance your forms.

WordPress by itself doesn’t provide a way to create contact forms, and basic form builder plugins don’t give you an option to add your own custom HTML to your forms. For real flexibility in creating forms, you’ll need to use a more advanced plugin like WPForms.

In this tutorial, we’ll walk you through how to add custom HTML to your WordPress forms using WPForms.

Why Add Custom HTML to Your Form

One of the main benefits of adding custom HTML to your form is that it helps you to make your form stand out from the rest of the content.

For instance, you can add an image to your form using custom HTML code to make the form visually appealing. This way, you can make the form stand out on the page, which helps to grab the attention of your visitors, in turn encouraging them to submit your form.

Adding custom HTML to your form creates a wide range of opportunities to enhance the usability of your WordPress form. Some of them are listed below.

WPForms is the best WordPress Form Builder plugin. Get it for free!
  • Embed a YouTube video: You can make your form more engaging by adding a YouTube or Vimeo video to your form.
  • Embed Google Maps: In your contact page, you can show the location of your business by embedding Google Maps on your contact form.
  • Show an exclusive offer with conditional logic: If you’re creating an order form, you can show an HTML block with an exclusive offer if a user selects a specific option in your form. This works great for upsells. To do this, you’ll need to use our smart conditional logic.

Creating a Form in WordPress

The first thing you need to do is to install and activate the WPForms plugin. Here’s a step by step guide on how to install a WordPress plugin.

Also, you’ll need to have a form created. To do so, you can see our tutorial on how to create a simple contact form as an example to get started.

Adding an HTML Block to Your Form

Now you need to add an HTML field to your form.

add html field

To insert your custom HTML code snippet, click on the HTML / Code block field you just added.

click on html code block

In the left panel, under Field Options, you’ll now see a field to add your custom code snippet.

add custom HTML to your WordPress forms

You can insert your custom HTML in that field and click Save on the top right panel.

save button

This way, you can add any type of custom HTML code snippet to your form.

Final Thoughts

Now that you’ve added custom HTML to your form, you can take a look at our guide on styling contact forms in WordPress to make sure your custom code looks the way you want it to.

So what are you waiting for? Get started with the most powerful WordPress forms plugin today.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Using WordPress and want to get WPForms for free?

Enter the URL to your WordPress website to install.


  1. Adding custom HTML to your form is a nice way to get creative and enhance your forms! Great article!

  2. I wish you would show an example of someone doing this (just because it sometimes it spurns ideas for me).

    1. Hi Reuben,

      Sure! The article mentions a couple examples (such as embedding a YouTube video or a Google Map), but there are lots of ways that people use this field. Here are a couple extra examples:

      Adding an image
      Adding terms of service or disclaimer
      – And, most commonly, adding a simple note to the user (often this is simple instructions, could be plain text or include basic HTML). Here’s a screenshot of an example that uses b tags (for bolded letters) and a tags (to create a link):

      I hope that helps! 🙂

    1. Hi Claudia,

      We’ll be including a basic option for this in the next update (it will just require a little custom code that we’ll provide, which you can then copy/paste into your site).

      That update will go out within the next couple of weeks (version 1.4.6), and you’ll see that in your WordPress updates page (or you can watch for the announcement post in our blog). After that, please feel welcome to get in touch and we’ll share all the details you’ll need. Or in the meantime, if you contact us there we can provide a workaround idea.

      Thanks! 🙂

  3. I need help! I’ve added the HTML Code properly but the image and text doesn’t show in the email sent by the wpform. We need this appear as it is part of a email contract.

    Can this be done?

    Am I missing something? What is the purpose of the HTML ID # and where do we paste it?

    1. Hi Michael,

      Sure, so in order to include an image in your email you’ll need to add the image HTML directly to the body of your email. We don’t include HTML fields in your emails normally since they often contain content that would essentially break the email.

      To set this up, you’ll need to open the form builder and go to Settings > Notifications. There, you’ll see the Message field. Just paste your image HTML (same code you added to the form) right here and the image will display in your email. I’d just recommend submitting the form yourself to test this out and be sure everything looks how you’d like.

      I hope this helps! If you have any additional questions, please get in touch and we’ll be happy to assist further 🙂

  4. I need to teach me how to add HTML on all my keywords on my site [URL removed], teach me please..

    1. Hi Danny,

      Our sister site,, has tons of great resources on improving SEO (through keywords and a bunch of other methods). Here’s an article from them that I’d suggest starting with: How to Improve Your Keyword Research to Boost Traffic and Sales.

      If you browse their blog, or use the search option in the right sidebar of their site, you’ll find a ton more helpful resources. Hope that helps! 🙂

  5. Is there any way to change the URL and action for the form? For instance, I found a form on CSS-Tricks that allows the site visitor to input their location and get directions to a pre-defined address. The form uses the “get” action and will redirect to Google Maps when the submit button is clicked.

    1. Hi Jim,

      We don’t have a way to implement quite what you’re describing, however we do have hooks that you can use to apply changes to what occurs when the submit button is clicked. For example, wpforms_process and wpforms_process_complete are a couple of popular hooks for adding new submission behaviors.

      Hopefully that’s a helpful starting point! 🙂

  6. Hi,
    is there a way to avoid reload of the page on click of the submit button when the form is open in a popup window? Something like

    If the form opens in a popup window, on the click of the submit button, instead of showing the confirmation button it reloads the whole page…

    1. Hi Luigi,

      What you describe is true — most popup windows are designed to either close or refresh the entire page when an embedded form is submitted. However, many of our users do still use forms in popups and get around the confirmation issue by redirecting users to a Thank You/Confirmation page rather than displaying a message where the form was.

      Here’s an article that will show how to set up a Thank You page, as well as some tips on what all you could include on it.

      If you need any further assistance with this please get in touch with our support team.


  7. Hi, Can I also place wordpress [shortcodes] inside the html element?
    I would like to display something with a [shortcode] like a slider.


    1. Hi Sebastiaan,

      We don’t have a built in way to allow shortcodes to process within the HTML field but you can accomplish this with a little bit of custom code:

      * Process shortcodes inside the HTML field.
      function wpf_dev_html_field_shortcodes( $field, $field_atts, $form_data ) {

      if ( ! empty( $field['code'] ) ) {
      $field['code'] = do_shortcode( $field['code'] );
      return $field;
      add_filter( 'wpforms_html_field_display', 'wpf_dev_html_field_shortcodes', 10, 3 );

      In case it helps, here’s our tutorial with the most common ways to add custom code like this.

      I hope this helps! If you need any extra assistance, contact support. 🙂

  8. Is it possible to use the above code, modified, to enable the html block to run php?

    I’ve got some custom ACF fields I’d like to show using


    1. Hi Renier,

      We currently don’t have that function but I have noted it as a feature request for our development team to consider down the road. Thanks for the suggestion! 🙂

      1. Hi Daisy
        Can I use wpforms and ACF fields to get user submitted location based marker section on the map in front-end?


      2. Hey Saeed – Great question! Yes, you can use ACF with WPForms to achieve a few things. For reference, here is an example. The same way you can get the custom fields input for ACF but to show them in the map on the front end is altogether a different game. You might need some extended dev work there.

        I hope this info helps!

  9. Hi,
    I am delighted with WPForms and have build a product order form.

    The challenge I can’t solve is how to add a ‘discount code’ and, when entered, to reduce the ‘Total’ price accordingly.

    Any ideas really appreciated.


    1. Hi Malcolm,

      We currently don’t have the ability to include coupon codes in our forms right now but in the meantime, I have an idea for a workaround that could work for you if your form setup is relatively simple. Here’s a screencast video demo so that you can see if my idea could be a good fit.

      To set up this example, I added two Multiple Items fields — one with normal pricing and one with discounted pricing. I also added a Single Line Text field to accept a coupon code.

      The last step was to create conditionals for each of the item fields. To do this, I clicked on one of those fields and that opened its Field Options screen. Here I opened the Conditionals section and checked ‘Enable Conditional Logic’.

      For the full price items, the logic should resemble this screenshot. This tells this field to be hidden if the correct coupon code is entered.

      The discounted item’s conditional logic should be set to display when that same ‘coupon code’ is entered.

      I realize this isn’t the idea solution for this but I hope this helps! 🙂

  10. When I add target=”_blank” to a link in the HTML code section the form won’t load.

    1. Hi Timothy,

      Can you make sure that both your site and the WPForms plugin are completely up to date? We experienced an issue not too long ago when adding the target=”_blank” element to a form.

      If that doesn’t work and you have a paid license, please feel free to contact our support team.


    1. Hi Appvizer, thanks for the question!
      For the HTML code, you can use the HTML field in WPForms. However, there are no built-in options to add validation for the HTML field.
      And if you will add some HTML code, it will be processed by the browser immediately when the form loaded, and not when the form is validated.
      For that purpose, you would need to use our PHP filter hook that fires when the Submit button is clicked but before the validation is done.
      I hope this helps.
      Have a good one 🙂

    1. Hey Gurpreet – We might need some more details to help you better on this. When you get a chance, please drop us a line in support so we can assist.

      Thanks 🙂

    2. I have a calculator created on an external software I have a html code. would i be able to add it here in order to get email confirmation?

      1. Hey Sam – Thanks for reaching out! We’ll need more details to understand your question. When you get the chance, please reach out to the support team for further help.

        Have a good one 🙂

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.