Using Gravity Forms ‘gform_entry_detail_title’ PHP filter

The gform_entry_detail_title filter in Gravity Forms allows you to modify the title displayed on the entry detail page.

Usage

add_filter('gform_entry_detail_title', 'my_function_call');

Parameters

  • $title (string): The title used.
  • $form (array): The form object.
  • $entry (array): The entry object.

More information

See Gravity Forms Docs: gform_entry_detail_title

Examples

Change the entry detail title

This example changes the entry detail title to “Your new title for entry #X”, where X is the entry ID.

function change_entry_detail_title($title, $form, $entry) {
  return 'Your new title for entry #' . $entry['id'];
}

add_filter('gform_entry_detail_title', 'change_entry_detail_title', 10, 3);

Add form title to entry detail title

This example adds the form title to the entry detail title.

function add_form_title($title, $form, $entry) {
  return $form['title'] . ' - ' . $title;
}

add_filter('gform_entry_detail_title', 'add_form_title', 10, 3);

Display custom field value as entry detail title

This example displays a custom field value as the entry detail title.

function custom_field_title($title, $form, $entry) {
  $custom_field_value = rgar($entry, '2'); // Replace '2' with the field ID
  return $custom_field_value;
}

add_filter('gform_entry_detail_title', 'custom_field_title', 10, 3);

Change entry detail title based on user role

This example changes the entry detail title based on the user’s role.

function user_role_title($title, $form, $entry) {
  $user = wp_get_current_user();

  if (in_array('administrator', $user->roles)) {
    return 'Admin - ' . $title;
  }

  return $title;
}

add_filter('gform_entry_detail_title', 'user_role_title', 10, 3);

Set entry detail title to current date

This example sets the entry detail title to the current date.

function current_date_title($title, $form, $entry) {
  return 'Entry Details - ' . date('F j, Y');
}

add_filter('gform_entry_detail_title', 'current_date_title', 10, 3);