Using Gravity Forms ‘gform_is_entry_detail_view’ PHP filter

The gform_is_entry_detail_view filter allows the “entry_detail” page to be marked as a regular page, not an admin or edit page, or a regular page to be marked as an Entry Detail page. This filter is useful if you are creating custom entry edit pages.

Usage

add_filter('gform_is_entry_detail_view', 'your_function_name', 10, 1);

Parameters

  • $is_entry_detail_view (bool): Whether the current page is the Entry Detail (entry_detail) page.

More information

See Gravity Forms Docs: gform_is_entry_detail_view

Examples

Set a regular page as an Entry Detail page

This example sets a regular page as an Entry Detail page by returning true.

add_filter('gform_is_entry_detail_view', 'set_entry_detail', 10, 1);

function set_entry_detail($is_entry_detail_view) {
    // Your custom code here
    return true;
}

Set Entry Detail page as a regular page

This example sets the Entry Detail page as a regular page by returning false.

add_filter('gform_is_entry_detail_view', 'set_regular_page', 10, 1);

function set_regular_page($is_entry_detail_view) {
    // Your custom code here
    return false;
}

Set Entry Detail page as a regular page for a specific page ID

This example sets the Entry Detail page as a regular page only for a specific page ID.

add_filter('gform_is_entry_detail_view', 'set_regular_page_for_id', 10, 1);

function set_regular_page_for_id($is_entry_detail_view) {
    // Your custom code here
    if (is_page(42)) {
        return false;
    }
    return $is_entry_detail_view;
}

Set a specific page as an Entry Detail page by page slug

This example sets a specific page as an Entry Detail page by its page slug.

add_filter('gform_is_entry_detail_view', 'set_entry_detail_by_slug', 10, 1);

function set_entry_detail_by_slug($is_entry_detail_view) {
    // Your custom code here
    if (is_page('custom-entry-detail')) {
        return true;
    }
    return $is_entry_detail_view;
}

Set Entry Detail page as a regular page for a specific user role

This example sets the Entry Detail page as a regular page only for users with a specific role.

add_filter('gform_is_entry_detail_view', 'set_regular_page_for_role', 10, 1);

function set_regular_page_for_role($is_entry_detail_view) {
    // Your custom code here
    if (current_user_can('editor')) {
        return false;
    }
    return $is_entry_detail_view;
}