How to remove "graphic display" and icon options from menu options - SOLVED

I was able to solve the issue I brought up in this post: How to remove "graphic display" and icon options from menu options

Having those custom fields in the menu options was conflicting with Megamenu and causing the page to load VERY slowly and sometimes even crash, making it extremely difficult to make any changes to the menu.

As I am a developer, I dug into the theme code (as well as the standalone Cornerstone plugin) and found where this is being added. I was able to stop the fields from being loaded by adding the following code into a custom plugin, but the same code could just be placed in the functions.php file should someone else want or need to remove them if they are causing issues. This has been tested with PHP 7 and PHP 8.2. I hope the devs will add this as an option somewhere in the theme options to turn this OFF should we not want those fields to load, but in the meantime, I wanted to provide an answer should someone else have the problem …

function gg_override_tco_menu_fields() {
   if (class_exists('CS_Menu_Item_Custom_Fields_Map')) {
      remove_action('wp_nav_menu_item_custom_fields', array( 'CS_Menu_Item_Custom_Fields_Map', '_fields' ), 10, 4);
      remove_action('wp_update_nav_menu_item', array( 'CS_Menu_Item_Custom_Fields_Map', '_save' ), 10, 3);
      remove_filter('manage_nav-menus_columns', array( 'CS_Menu_Item_Custom_Fields_Map', '_columns' ), 99);
   }
}
add_action('init', 'gg_override_tco_menu_fields', 11);

Hey @geekgoddessx,

We really appreciate for sharing this resolution to the issue you had experienced on your site. The code will be helpful for other users as well.

Cheers.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.