gpnf_expiration_modifier

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Set orphan expiration duration

Description

Modify how long entries submitted from a nested form should be saved before being moved to the trash.

Usage

add_filter( 'gpnf_expiration_modifier', 'my_custom_function' );

Parameters

  • seconds int

    The number of seconds until the entry should be “expired”. Defaults to one week in seconds.

Since

This filter is available since Gravity Forms Nested Forms 1.0.

Examples

Set orphan expiration duration

The following snippet contains two examples of expiration durations: Expire orphans after 1 month and never expire orphans.

<?php
/**
 * Gravity Perks // Nested Forms // Set Orphaned Entry Expiration Duration
 * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
 *
 * Modify how long entries submitted from a nested form should be saved before being moved to the trash.
 */
// Expire orphaned entries after 30 days (1 month).
add_filter( 'gpnf_expiration_modifier', function() {
	return MONTH_IN_SECONDS;
} );

// Never expire orphaned entries.
add_filter( 'gpnf_expiration_modifier', function() {
	return 100 * YEAR_IN_SECONDS;
} );