gform_check_empty_index_file_exists

Description

The gform_check_empty_index_file_exists filter allows you to control whether Gravity Forms checks for the existence of an index.html file in a directory before creating one.

Usage

Applies to all forms:

add_filter( 'gform_check_empty_index_file_exists', 'your_function_name', 10, 2);

Parameters

  • $check_file_exists bool
    Whether to check if the empty index file exists before adding it.
    Defaults to false.
  • $dir string
    The directory path where the empty file is being added.

Examples

Prevent the creation of multiple empty index.html files

add_filter( 'gform_check_empty_index_file_exists', 'only_add_once', 10, 2 );
function only_add_once( $check, $dir ) {
	return true;
}

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?

Source Code

This filter is located in /common.php

Since

The filter was added in Gravity Forms 2.9.2