Using Gravity Forms ‘gform_entry_detail_url’ PHP filter

The gform_entry_detail_url filter allows you to modify the entry_url placeholder to handle situations where the wpurl might not match the admin_url.

Usage

add_filter('gform_entry_detail_url', 'your_function_name', 10, 3);

Parameters

  • $entry_url (string): The Entry URL to filter.
  • $form (Form Object): The current form object.
  • $entry (Entry Object): The current entry object.

More information

See Gravity Forms Docs: gform_entry_detail_url

Examples

Replace Localhost URL with Custom Domain

This example replaces the localhost URL with a custom domain in the entry detail URL.

add_filter('gform_entry_detail_url', 'filter_url', 10, 3);

function filter_url($entry_url, $form, $entry){
    $entry_url = str_replace('http://localhost', 'http://rocketgenius.com', $entry_url);
    return $entry_url;
}

Add Custom Query Parameters

This example adds custom query parameters to the entry detail URL.

add_filter('gform_entry_detail_url', 'add_custom_query_params', 10, 3);

function add_custom_query_params($entry_url, $form, $entry){
    $entry_url .= '&custom_param=value';
    return $entry_url;
}

Redirect to Different Admin Page

This example redirects the entry detail URL to a different admin page.

add_filter('gform_entry_detail_url', 'redirect_admin_page', 10, 3);

function redirect_admin_page($entry_url, $form, $entry){
    $entry_url = admin_url('admin.php?page=my_custom_page');
    return $entry_url;
}

Change Entry URL Based on Form ID

This example changes the entry detail URL based on the form ID.

add_filter('gform_entry_detail_url', 'change_url_based_on_form_id', 10, 3);

function change_url_based_on_form_id($entry_url, $form, $entry){
    if ($form['id'] == 1) {
        $entry_url = 'https://example.com/custom-entry-url';
    }
    return $entry_url;
}

Add Hash to Entry URL

This example adds a hash to the entry detail URL for security purposes.

add_filter('gform_entry_detail_url', 'add_hash_to_entry_url', 10, 3);

function add_hash_to_entry_url($entry_url, $form, $entry){
    $hash = md5($entry['id'] . 'secure_string');
    $entry_url .= '&hash=' . $hash;
    return $entry_url;
}