### [How to Password Protect a Submit Button](https://wpforms.com/developers/how-to-password-protect-a-submit-button/)

**Published:** December 6, 2023
**Author:** Editorial Team

**Excerpt:** This tutorial will show you how to password-protect a Submit button on any form for your site using a small PHP snippet. 

**Content:**

## Introduction

Would you like to password-protect a **Submit** button? Did you know that you can already password-protect an entire form by following the [detailed guide in this documentation](https://wpforms.com/how-to-password-protect-wordpress-forms-step-by-step/ "How to Make a Password-Protected Form in WordPress (Step by Step)")? However, there may be times when you just want to place the password on the **Submit** button only and in this tutorial, we’ll show you how! Let’s get started!

## Creating the form

To begin, create a new form and add your fields. If you need any help in creating a form, [please check out this useful guide](https://wpforms.com/docs/creating-first-form/ "Creating Your First Form").

![begin by creating a form and adding your fields](https://wpforms.com/wp-content/uploads/2023/12/wpforms-create-form-password-submit.jpg)

The last field for our form is a **Single Line Text** field that we’ll use to allow visitors to enter a password.

![using a Single Line Text field, make this your last field on the form that will allow users to enter a password](https://wpforms.com/wp-content/uploads/2023/12/wpforms-password-text-field.jpg)

## Adding the snippet

Now it’s time to add the snippet to your site. If you’re not sure where or how to add snippets to your site, [please review this detailed step-by-step guide](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Password-protect a submit button
 *
 * @link https://wpforms.com/developers/how-to-password-protect-a-submit-button/
 */
 
add_action( 'wp_head', function () { ?>

**Categories:** Tutorials

**Tags:** PHP

---

