{"id":21700128,"url":"https://github.com/wp-digital/wp-recaptcha","last_synced_at":"2025-04-12T13:34:02.933Z","repository":{"id":56991752,"uuid":"58372235","full_name":"wp-digital/wp-recaptcha","owner":"wp-digital","description":"Helps to protect website with Google reCAPTCHA v3 or Cloudflare Turnstile.","archived":false,"fork":false,"pushed_at":"2023-08-29T12:28:38.000Z","size":792,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-08T18:49:07.987Z","etag":null,"topics":["recaptcha","recaptcha-v3","security","turnstile","wordpress-plugin","wp-digital"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-digital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-09T11:42:54.000Z","updated_at":"2023-09-13T06:14:28.000Z","dependencies_parsed_at":"2022-08-21T12:20:33.291Z","dependency_job_id":null,"html_url":"https://github.com/wp-digital/wp-recaptcha","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-recaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-recaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-recaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-digital%2Fwp-recaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-digital","download_url":"https://codeload.github.com/wp-digital/wp-recaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248163635,"owners_count":21057983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["recaptcha","recaptcha-v3","security","turnstile","wordpress-plugin","wp-digital"],"created_at":"2024-11-25T20:12:56.992Z","updated_at":"2025-04-12T13:34:02.915Z","avatar_url":"https://github.com/wp-digital.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bot Protection\n\n### Description\n\nHelps to protect website with [Google reCAPTCHA v3](https://www.google.com/recaptcha/about/) or\n[Cloudflare Turnstile](https://www.cloudflare.com/products/turnstile/). This plugin provides Login and Lost Password\nforms protection by default, but it's possible to add protection to any form by following this documentation.\n\n### Requirements\n\n- PHP 7.4+\n- WordPress 6.2+ (you can try with older versions, but it's not tested)\n\n### Features\n\n- Protects Login and Lost Password forms by default.\n- Supports Google reCAPTCHA v3 and Cloudflare Turnstile.\n- Allows IP addresses to bypass verification.\n- Sends verification email to user.\n- Allows to customize verification email subject, message body and link.\n- Allows to customize verification code length.\n- Allows to add protection to custom form.\n\n### Screenshots\n\n![Google reCAPTCHA v3](./screenshots/Google-reCAPTCHA-v3.png)\n\n![Cloudflare Turnstile](./screenshots/Cloudflare-Turnstile.png)\n\n![Verification](./screenshots/verification.png)\n\n![Allowed IPs](./screenshots/allowed-IPs.png)\n\n### Install\n\n- Preferable way is to use [Composer](https://getcomposer.org/):\n\n    ````\n    composer require wp-digital/wp-recaptcha\n    ````\n\n    By default, it will be installed as [Must Use Plugin](https://codex.wordpress.org/Must_Use_Plugins).\n    But it's possible to control with `extra.installer-paths` in `composer.json`.\n\n- Alternate way is to clone this repo to `wp-content/mu-plugins/` or `wp-content/plugins/`:\n\n    ````\n    cd wp-content/plugins/\n    git clone git@github.com:wp-digital/wp-recaptcha.git\n    cd wp-recaptcha/\n    composer install\n    ````\n\nIf plugin was installed as regular plugin then activate **Bot Protection** from Plugins page \nor [WP-CLI](https://make.wordpress.org/cli/handbook/): `wp plugin activate wp-recaptcha`.\n\n### Usage\n\nAdd required constants (usually to `wp-config.php`):\n\n````\ndefine( 'WPD_RECAPTCHA_KEY', '' );\ndefine( 'WPD_RECAPTCHA_SECRET', '' );\n````\n\nor just:\n\n````\ndefine( 'RECAPTCHA_KEY', '' );\ndefine( 'RECAPTCHA_SECRET', '' );\n````\n\nDepending on constants, plugin will use Google reCAPTCHA v3 or Cloudflare Turnstile. If both constants are empty then\nplugin will be disabled.\n\nCloudflare Turnstile is detecting based on `WPD_RECAPTCHA_KEY` or `RECAPTCHA_KEY` constant,\nby using regex: `^\\dx`.\n\n#### Allow IP addresses to bypass verification\n\nThere are two ways to allow IP addresses to bypass verification:\n\n1. Add IP addresses to `WPD_RECAPTCHA_ALLOWED_IPS` constant:\n\n\t````\n\tdefine( 'WPD_RECAPTCHA_ALLOWED_IPS', '' ); // comma separated list of IP addresses\n \t````\n\n2. Add IP in admin area: **Settings** -\u003e **Bot Protection** -\u003e **Allowed IPs**,\n   one IP per line (see [screenshots](#screenshots)).\n\n### Customization\n\n#### Verification\n\nChange verification email subject:\n\n````\n/**\n * @param string  $subject\n * @param string  $code\n * @param WP_User $user\n *\n * @return string\n */\nadd_filter( 'wpd_recaptcha_verification_email_subject', function ( string $subject, string $code, WP_User $user ): string {\n\treturn 'New subject';\n}, 10, 3 );\n````\n\nChange verification email message body:\n\n````\n/**\n * @param string  $message\n * @param string  $code\n * @param WP_User $user\n *\n * @return string\n */\nadd_filter( 'wpd_recaptcha_verification_email_message', function ( string $message, string $code, WP_User $user ): string {\n\treturn 'New message';\n}, 10, 3 );\n````\n\nModify verification link:\n\n````\n/**\n * @param string  $link\n * @param string  $code\n * @param WP_User $user\n *\n * @return string\n */\nadd_filter( 'wpd_recaptcha_verification_link', function ( string $link, string $code, WP_User $user ): string {\n\treturn 'https://example.com/verify/' . $code;\n}, 10, 3 );\n````\n\nChange verification code length:\n\n````\n/**\n * @param int $length\n *\n * @return int\n */\nadd_filter( 'wpd_recaptcha_verification_code_length', function ( int $length ): int {\n\treturn 10;\n} );\n````\n\n### Hooks\n\n#### Actions\n\n- `wpd_recaptcha_loaded` - Fires when plugin is loaded. Accepts one argument: `WPD\\Recaptcha\\Plugin` instance.\n- `wpd_recaptcha_verify` - Fires when verification is required. Accepts one argument: `WP_User` instance.\n- `wpd_recaptcha_form_success` - Fires when reCAPTCHA or Turnstile validation is successful. Accepts two arguments:\n  `WPD\\Forms\\FormInterface` instance and `WPD\\Recaptcha\\Response` instance.\n\n### Documentation\n\nAdd protection to custom form:\n\n- Create class which implements form interface `WPD\\Forms\\FormInterface`:\n\n\t````\n \t\u003c?php\n\n \tuse WPD\\Forms\\FormInterface;\n\n \tclass CustomForm implements FormInterface {\n \t\t// @TODO: implement methods\n \t}\n \t````\n\n- Add form to `wpd_recaptcha_forms` filter:\n\n\t````\n\t/**\n\t * @param array $forms\n\t *\n\t * @return array\n\t */\n\tadd_filter( 'wpd_recaptcha_forms', function ( array $forms ): array {\n\t\t$forms[] = new CustomForm();\n\n\t\treturn $forms;\n\t} );\n\t````\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-digital%2Fwp-recaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-digital%2Fwp-recaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-digital%2Fwp-recaptcha/lists"}