Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
152 lines (136 sloc) 2.73 KB
title description
Menus
Learn about how to interact with Pages using WPGraphQL

import GraphiQL from '../../components/GraphiQL'

There are various points of entry for menus and their items.

Queries

The menus query is the only query that will return all of the menus on your site. If you would like to query a specific menu or that menu's data, you will need the menu or menuItem's ID.

Menus

After running the menus query grab one of the IDs in the response and use it in the other queries below.

Menu

<GraphiQL withDocs={true} query=' query GET_MENU( $id: ID! ){ menu(id: $id) { count id menuId name slug menuItems { nodes { id menuItemId title url cssClasses description label linkRelationship target } } } }' variables={ { id: 'TWVudTo5' } } />

Menu Item

<GraphiQL withDocs={true} query=' query GET_MENU_ITEM( $id: ID! ){ menuItem( id: $id ) { id menuItemId title url connectedObject { __typename } cssClasses description label linkRelationship target }}' variables={{ id: 'bmF2X21lbnVfaXRlbToxMDQ2' }} />

Menu Items

You can’t perform that action at this time.