Summary
MemberPress Card Testing Protection automatically blocks any IP address after five failed payment attempts within a two-hour window. While this feature prevents fraudulent card testing, it can also block trusted IP addresses. Support agents, office staff, or developers testing payments may trigger the protection unintentionally.
This document explains why removing an IP from the blocked list does not resolve the issue immediately. It also provides a code-based solution using the mepr_anti_card_testing_ip filter to permanently exempt a specific IP address from card testing protection.
Troubleshooting
Cause of the Issue
When an IP address triggers five or more failed payment attempts within two hours, MemberPress adds it to the Blocked IP Addresses list. A failed_payments transient is used to track the failure count for that IP.
Removing the IP from the Blocked IP Addresses list does not delete the associated transient. The transient retains its count (five or greater) until it expires naturally after two hours or is cleared manually.
This creates the following sequence of events:
- The IP hits five or more failures and is added to the blocked list. The transient count remains at five or greater.
- An admin removes the IP from the Blocked IP Addresses textarea and saves. The IP is removed, but the transient still holds its count.
- On the next purchase attempt, MemberPress reads the same transient. Since the count is still five or greater, the IP is immediately re-added to the blocked list.
Prerequisites
The following is required to implement the solution in this document:
- MemberPress — active and installed on the WordPress site;
- WPCode plugin (or access to the child theme’s
functions.phpfile) — to add the custom code filter; - The specific IP address to be exempted — this must be known before implementing the solution.
Exempting a Specific IP Using the mepr_anti_card_testing_ip Filter
The recommended approach is to use the mepr_anti_card_testing_ip filter. This filter intercepts the IP address that MemberPress evaluates for card testing protection. It replaces the trusted IP with a non-routable address that will never trigger the protection.
To implement this solution:
- Navigate to Dashboard > Plugins > Code Snippets and click Add New Snippet. Alternatively, open the child theme’s
functions.phpfile. - Add the following code snippet.
// MemberPress - Exempt a Specific IP From Card Testing Protection
// Replace the IP address on line 4 with the actual IP to exempt.
add_filter( 'mepr_anti_card_testing_ip', function( $ip ) {
// Replace with the actual trusted IP address
$specific_ip = '203.0.113.10';
// If the detected IP matches, swap it to a non-routable address
if ( $ip === $specific_ip ) {
return '10.0.0.1';
}
return $ip;
} );
Code Explanation
The code snippet includes the following modifiable elements:
$specific_ip = '203.0.113.10';(line 6) — This is the IP address to exempt. Replace203.0.113.10with the actual trusted IP address (e.g., an office or support team IP);return '10.0.0.1';(line 10) — This is the non-routable substitute IP address. The value10.0.0.1is a private address that will never be associated with real site visitors. This value does not need to be changed unless it conflicts with the internal network configuration.
- Click Save Snippet and toggle the snippet to Active. If using the child theme’s
functions.php, save the file.
Verifying the Solution
After applying the filter, verify that the exemption is working correctly:
- Navigate to Dashboard > MemberPress > Settings > General and scroll to the Card Testing Protection section.
- Confirm the exempted IP address is not listed in the Blocked IP Addresses textarea.
- Attempt a test payment from the exempted IP address.
- Confirm the payment processes without the IP being re-added to the blocked list.
- If the IP was previously blocked, wait for the existing
failed_paymentstransient to expire (two hours) before testing. Alternatively, clear the transient manually.
Additional Troubleshooting
If the IP continues to be re-blocked after applying the filter, check the following:
IP Address Does Not Match
The IP address in the code must exactly match the blocked IP. IP addresses are case-sensitive and must be an exact string match. Confirm the correct IP by checking the Blocked IP Addresses textarea or asking the affected user to visit a service such as whatismyipaddress.com.
Transient Has Not Yet Expired
If the IP was already blocked before the filter was applied, the existing failed_payments transient may still be active. The transient expires after two hours. Wait for it to expire, or clear it manually from the database.
Code Snippet Is Not Active
Navigate to Dashboard > Code Snippets and confirm the snippet is enabled. Check that it has no syntax errors. If the snippet was added to functions.php, confirm the file was saved successfully.
Caching or Security Plugin Interference
Some caching or security plugins may alter how IP addresses are detected by WordPress. If the issue persists, temporarily disable caching and security plugins to rule out interference. Server-level caching (e.g., Varnish or Nginx caching) may also need to be cleared.
Known Limitations
- This solution exempts only one IP address per code snippet. To exempt multiple IPs, the code must be modified to check against an array of addresses;
- If the trusted IP address changes (e.g., due to a dynamic IP assignment from the ISP), the code snippet must be updated with the new IP;
- The filter does not retroactively remove an IP from the blocked list. If the IP is currently blocked, it must either be removed manually from the textarea or allowed to expire;
- The
mepr_anti_card_testing_ipfilter bypasses card testing protection entirely for the specified IP. Any fraudulent activity from that IP will not be detected by this feature.
Result
Once the mepr_anti_card_testing_ip filter is in place, the specified IP address is substituted with a non-routable internal address before MemberPress evaluates it. This prevents the trusted IP from being added to the blocked list regardless of the number of failed payment attempts.








