Where Are Menu Stored in WordPress Database?
Menu storage in WordPress is handled by the wp_menu table. This table is located in the wp_content database. The wp_menu table has the following columns:
menu_name – The name of the menu item.
– The name of the menu item. parent_menu_id – The ID of the parent menu item.
– The ID of the parent menu item. slug – The slug for the menu item.
– The slug for the menu item. is_active – Whether the menu item is currently active.
– Whether the menu item is currently active. is_subscribed – Whether the menu item is subscribed.
– Whether the menu item is subscribed. menu_order – The order in which the menu item appears in the menu.
The wp_menu table has the following fields:
menus – An array of menu items.
– An array of menu items. post_types – An array of post type IDs.
– An array of post type IDs. taxonomies – An array of taxonomy IDs.
– An array of taxonomy IDs. terms – An array of terms IDs.
– An array of terms IDs. menu_items – An array of menu items.
wp_menu also has the following fields:
current_menu_id – The ID of the current menu.
wp_menu can be queried using the following functions:
get_the_menu() – Returns the contents of the current menu.
– Returns the contents of the current menu. get_the_children() – Returns the children of the current menu.
– Returns the children of the current menu. get_the_submenus() – Returns the submenus of the current menu.
– Returns the submenus of the current menu. get_the_subitems() – Returns the items in the submenus of the current menu.
– Returns the items in the submenus of the current menu. get_the_terms() – Returns the terms in the taxonomies of the current menu.
– Returns the terms in the taxonomies of the current menu. get_the_slugs() – Returns the slugs for the menu items in the current menu.
wp_menu can be cleared using the following function:
wp_clear_menu().