As of version 3.8, USP Pro makes it possible to add a “disable comments” checkbox to any USP Form. This super quick tutorial shows how.

Step 1

Add the following code to any USP Form:

<div class="usp-input usp-checkboxes">
	<label for="usp-comments"> 
	<input id="usp-comments" name="usp-comments" type="checkbox"> Disable Comments</label>

You can customize most of that markup, but the input name must be usp-comments in order to work properly.

Pro Tip: To wrap the disable-comments checkbox with <fieldset>, you can use the [usp_fieldset] shortcode. Learn more »

Step 2

Save changes and done!

Nothing else is required. To test that it’s working try submitting a few test posts via your form. For any submitted posts where the “disable comments” box is checked, commenting will be disabled on the submitted post. Otherwise, if the box is not checked, comments will be enabled or disabled based on your WordPress settings.

Advanced: Make it a hidden field

In some cases, you may to disable comments on ALL posts submitted by some USP Form. In such case, use this code:

<input name="usp-comments" type="hidden" value="disable">

So instead of using the code provided in step 1 above, you would use this code instead. When added to a USP Form, that line tells WordPress that comments should be disabled on each post. So instead of giving the user an option to disable, you are requiring comments to be disabled for posts submitted via that specific form.