Filters and Hooks
The Procaptcha plugin introduces new WordPress filters and hooks, allowing you to customize its behavior.
1. Captcha Visibility
Section titled 1. Captcha VisibilityBy default, Procaptcha is displayed only to unauthorized users.
To control this behavior, besides the plugin settings, you can use the is_captcha_present
hook.
For example, to make Procaptcha required for everyone, add the following code to your theme’s functions.php file:
2. Custom Error Message
Section titled 2. Custom Error MessageYou can customize the default error message by adding this code to your theme’s functions.php file:
3. Customizing Procaptcha Attributes
Section titled 3. Customizing Procaptcha AttributesBeyond the style preferences in the plugin settings, you can customize any supported Procaptcha data attributes using the prosopo/procaptcha/captcha_attributes filter.
4. Forms with Procaptcha in Tests
Section titled 4. Forms with Procaptcha in TestsIf your tests involve forms with Procaptcha, you can bypass the Procaptcha by adding the following constant to your wp-config.php file:
In your tests, add an input[name=procaptcha-response] element with the value bypass to any form to simulate Procaptcha completion.
Important: This bypass constant should only be used in development environments.
Learn