Preventing Spam with reCAPTCHA
reCAPTCHA is a free service provided by Google which lets you embed a CAPTCHA field to forms on your site to stop posts submitted by robots or abusive scripts.
Setting up reCAPTCHA
Follow the instructions below to setup reCAPTCHA:
Generate Google reCAPTCHA API keys for your site. Make sure to select reCAPTCHA V2 as the type of reCAPTCHA when registering your site.
Go to the WordPress administration dashboard and click Directories in the admin sidebar.
Click the Settings tab, then the reCAPTCHA sub-tab and configure the following:
reCAPTCHA API site/secret key - Enter the API keys generated on Google in step 1.
reCAPTCHA theme - Select the color theme of the CAPTCHA field.
reCAPTCHA type - Select the type of CAPTCHA to serve. Note that the challenge popup is displayed only when the user stays on the page for more than 5 minutes.
reCAPTCHA size - Select the display size of the CAPTCHA field.
Scroll down the page and press Save Changes.
Adding reCAPTCHA to forms
Follow the steps below to add reCAPTCHA to the listing submission form on the add listing page.
Login to your website if not yet logged in and go to the WordPress administration dashboard.
Click Directories in the admin sidebar.
Under the All Directories tab, click the gear icon in the row of the directory to edit.
Under the Content Types tab, click the dropdown button in the Listing row and then click Manage Fields.
Click the green Add Element button with a plus sign at the bottom of the page.
In the popup window, click the Utility tab, hover over to the reCAPTCHA element and click.
Leave the settings as-is, and press the Add Element button at the bottom of the popup window to add the reCAPTCHA element.
reCAPTCHA can also be added to the claim listing form and the review submission form by repeating the same steps above for Claim or Review instead of Listing.
If custom login/registration forms are enabled, reCAPTCHA can also be added to those forms. See User Login/Registration and Guest Posts for more details.
Force disable reCAPTCHA
If you have enabled reCAPTCHA in your login form and for some reason reCAPTCHA stopped working and you are unable to login, you can add the following line of code to your wp-config.php file to force disable reCAPTCHA:
Make sure to add the line to wp-config.php above where it says:
/* That's all, stop editing! Happy blogging. */