The gform_print_entry_notes filter allows you to override the printing of entry notes as the entry markup is prepared for the print view.
Usage
To apply this filter to all forms, use the following code:
add_filter('gform_print_entry_notes', 'your_function_name', 10, 3);
Parameters
- $print_entry_notes (bool): Indicates if printing of notes was enabled via the entry list or detail pages.
- $entry (Entry Object): The current entry.
- $form (Form Object): The current form object.
More information
See Gravity Forms Docs: gform_print_entry_notes
Examples
Always include the notes
To always include entry notes when printing, use this code:
add_filter('gform_print_entry_notes', '__return_true');
Always exclude the notes
To always exclude entry notes when printing, use this code:
add_filter('gform_print_entry_notes', '__return_false');
Invert the choice selected in the admin
To invert the choice selected in the admin regarding printing of entry notes, use this code:
add_filter('gform_print_entry_notes', function($print_entry_notes) { return !$print_entry_notes; });
Custom function to include or exclude notes based on form ID
To include or exclude notes based on a specific form ID, use this code:
function my_custom_print_entry_notes($print_entry_notes, $entry, $form) { if ($form['id'] == 1) { return true; } return $print_entry_notes; } add_filter('gform_print_entry_notes', 'my_custom_print_entry_notes', 10, 3);
Custom function to include or exclude notes based on entry creation date
To include or exclude notes based on the entry creation date, use this code:
function my_custom_print_entry_notes_by_date($print_entry_notes, $entry, $form) { $entry_date = strtotime($entry['date_created']); $cutoff_date = strtotime('2023-01-01'); if ($entry_date >= $cutoff_date) { return true; } return $print_entry_notes; } add_filter('gform_print_entry_notes', 'my_custom_print_entry_notes_by_date', 10, 3);
Place any of the above code examples in the functions.php
file of your active theme. The gform_print_entry_notes
filter was added in Gravity Forms version 2.4.17. The filter is located in gform_default_entry_content()
in print-entry.php
.