Module — 6 operations

Menus

Navigation menus, their items, their order, and which theme location each one is assigned to.

Nothing extra to install. This module runs on core WordPress alone.

Cue 2 — first light

Before you call anything here

Note 1

menu-items-reorder takes the whole tree in one call, because reordering navigation one item at a time leaves the menu briefly wrong in a way a visitor can see.

Note 2

Theme locations are read and written explicitly. An agent never guesses which menu is the header.

Reads — 2

What it can tell you

A read still asks WordPress for a capability against the object. There is no anonymous read anywhere in the surface.

menu-list

menu-read

Lists menus with their theme location assignments

needs edit_theme_options

Read
menu-get

menu-read

Reads one menu's full item tree

needs edit_theme_options

Read
Writes — 4

What it can change

Every one of these is previewed before it runs, snapshotted before it changes anything, and verified afterwards by reading the site back. The chips are the policies the operation itself declares.

menu-item-create

menu-write

Adds an item to a menu

needs edit_theme_options

medium risk rollback supported
menu-item-update

menu-write

Updates an item's label, target, or attributes

needs edit_theme_options

medium risk rollback supported
menu-items-reorder

menu-write

Reorders and re-parents a menu tree

needs edit_theme_options

medium risk rollback supported
menu-location-assign

menu-write

Assigns a menu to a theme location

needs edit_theme_options

medium risk rollback supported
Cue 5 — day

Keep reading