Skip to content

Forcing feed errors with test mode

Feed Error Alerts includes a built-in Test Mode that allows you to safely simulate feed failures using specific values in your form submissions. It’s a great way to preview how alerts work, confirm integration with third-party addons, or demo features for a client.

 

What does test mode do?

When test mode is active:

  • Feeds and form submissions continue to process normally
  • But when specific “test” values are detected, the plugin forces the feed to fail
  • This triggers a test error in the dashboard (and alert, if enabled)

Note that while test mode is enabled, all forms and feeds will continue to work as normal. It just adds the ability to do these tests as well.

How to enable test mode

You can enable test mode either via the settings screen or programmatically:

Option 1: Enable via settings

Toggle the “Enable testing” switch under the “Testing” section in plugin settings.

Option 2: Enable via filter

Enable test mode with this filter:

add_filter( 'gffea_enable_testing', '__return_true' );

This is helpful for enabling testing only in specific environments, such as staging.

Triggering a test error (default values)

To simulate an error:

  1. Enable test mode
  2. Submit a form connected to a supported feed
  3. Use one of the following test values in a relevant mapped field:

Email: [email protected]
Replaced with an invalid email

Phone: 333-333-333
Replaced with an empty string

Text: failed_feedalerts_test
Replaced with an empty string

These test values are looked for after submission, so client-side validation will still pass.

Example use cases

ActiveCampaign Contact feed
Use [email protected] in the mapped email field to simulate a failed contact sync.

Breeze Card feed
Use failed_feedalerts_test in the card title to simulate failure from an empty value.

Twilio feed
Use 333-333-333 in the phone field to simulate an invalid message.

Advanced customization (optional)

You can override the test behavior using a series of filters. These are helpful for advanced use cases or addon-specific needs.

Customize the test input value

To change what value the plugin listens for (per field type):

<?php
// Email
add_filter( 'gffea_test_input_email', function( $test_email, $filter_name ) {
    return '[email protected]';
}, 10, 2 );

// Phone
add_filter( 'gffea_test_input_phone', function( $test_phone, $filter_name ) {
    return '999-999-999';
}, 10, 2 );

// Text
add_filter( 'gffea_test_input_string', function( $test_string, $filter_name ) {
    return 'simulate_feed_fail';
}, 10, 2 );

Customize the return value that causes failure

By default, test values are replaced with values that will make the feed fail. You can override those as well:

<?php
// Email
add_filter( 'gffea_test_return_email', function( $return_value, $filter_name, $input_value ) {
    return 'invalid_email_trigger';
}, 10, 3 );

// Phone
add_filter( 'gffea_test_return_phone', function( $return_value, $filter_name, $input_value ) {
    return '';
}, 10, 3 );

// Text
add_filter( 'gffea_test_return_string', function( $return_value, $filter_name, $input_value ) {
    return '';
}, 10, 3 );

Recap of all available filters

PurposeFilter Name
Enable test modegffea_enable_testing
Override test email valuegffea_test_input_email
Override returned email (causes error)gffea_test_return_email
Override test string valuegffea_test_input_string
Override returned string (causes error)gffea_test_return_string
Override test phone valuegffea_test_input_phone
Override returned phone (causes error)gffea_test_return_phone