gravityflowfolders_folder_match_add_step

Description

Added in version 1.4

The gravityflowfolders_folder_match_add_step filter allows determination of whether entry should be added to a folder to be customized.

Parameters

ParameterTypeDefinition
$setting_key_matchBooleanDoes the folder match current step settings.
$folderArrayThe potential folder to add the entry to.
$entry_idInteger
The entry ID.
$current_stepStep
The current step for this entry.

Examples

Compare entry field value against folder names

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
add_filter( 'gravityflowfolders_folder_match_add_step', 'folders_execgroup_match', 10,  4 );
function folders_execgroup_match( $match, $folder, $entry_id, $step ) {
    // Ensure it only executes on a specific step.
    if( $step->get_id() !== 40 ) {
        return $match;
    }
         
    $entry = GFAPI::get_entry( $entry_id );
    // Compare entry field #3 value to the folder name
    if( $entry && $folder->get_name() == $entry['3'] ) {
        $match = true;
    } else {
        $match = false;
    }
     
    return $match;
}

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?