Change URL of plugin admin menu

Gravity Forms adds a Admin Menu called Entries that points to page=gf_entries. I am trying to modify this URL so that it defaults to page=gf_entries&id=2 instead. Below is the order of my WordPress Admin Menu. How can I update the URL of the Entries menu item?

Dashboard
Posts
Media
Forms
-Forms
-New Form
-Entries

Related posts

2 comments

  1. Solution –

    add_action( 'admin_menu', 'wpse_admin_menu', 100 );
    function wpse_admin_menu()
    {
        global $menu, $submenu;
        $parent = 'gf_edit_forms';
        if( !isset($submenu[$parent]) )
            return;
    
        foreach( $submenu[$parent] as $k => $d ){
            if( $d['2'] == 'gf_entries' )
            {
                $submenu[$parent][$k]['2'] = 'admin.php?page=gf_entries&id=2';
                break;
            }
        }
    }
    
  2. The “Access denied” gave me a headache actually. It seems to be a gravity forms issue, maybe something with callback, i dont know.
    Even doing:

    unset($submenu['gf_edit_forms']['2']);
    

    breaks thye permissions down.

    I managed to add new Entries Button and hide previous one by css
    (which is kind of workaround i guess)

    The only drawback is that “Entries” is not Bold while you are on the Entries Page (You could probably give some more CSS to it but i don’;t acually mind)

    It goes like this:

    add_filter( 'gform_addon_navigation', 'add_menu_item' );
    function add_menu_item( $menu_items ) {
        $menu_items[] = array( "name" => "gf_entries&id=2", "label" => "Entries", "callback" => "gf_entries&id=2", "permission" => "gform_full_access" ); //edit_posts
        return $menu_items;
    }
    
    add_action('admin_head', 'my_custom_fonts');
    function my_custom_fonts() {
      echo '<style>
        #toplevel_page_gf_edit_forms > ul > li:nth-child(4){
            display:none !important;
        }
      </style>';
    }
    

Comments are closed.