gform_is_feed_error_retryable

Description

The gform_is_feed_error_retryable filter determines whether a feed should remain in the queue for another processing attempt after encountering an error. This filter allows you to customize retry logic based on the specific error that occurred during feed processing.

Usage

add_filter( 'gform_is_feed_error_retryable', 'your_function_name', 10, 5 );

Parameters

ParameterTypeDescription
$retryboolIndicates if the feed can be retried following an error. Default is true.
$errorWP_ErrorThe error that occurred during feed processing.
$feedarrayThe feed that was processed.
$entryarrayThe entry the feed was processed for.
$formarrayThe form the entry and feed belong to.

Examples

Prevent retries for specific error codes.

add_filter( 'gform_is_feed_error_retryable', function( $retry, $error, $feed, $entry, $form ) {
    // Don't retry if the error code indicates a permanent failure
    $non_retryable_codes = array( 'api_not_initialized', 'invalid_email', 'empty_content', 'invalid_date', 'empty_user_data', 'user_already_exists', 'invalid_user_id' );
    
    if ( in_array( $error->get_error_code(), $non_retryable_codes ) ) {
        return false;
    }
    
    return $retry;
}, 10, 5 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms 2.9.25

Source Code

This filter is located in GFFeedAddOn::is_feed_error_retryable() in includes/addon/class-gf-feed-addon.php.