Menus

Reordering navigation without a visitor seeing it half-done.

Menus, their items, their nesting and their theme locations. The whole tree moves in one call, because navigation reordered item by item is briefly wrong in a way people notice.

Anyone restructuring a site’s information architecture, or repeatedly fixing a menu that grew by accretion.

3 jobs

What people actually ask for.

Each of these is carried by named operations that exist in the release you can download today. The ids under every answer are the calls involved — nothing here is a plan.

“Reorganise the header: Services above Work, with the three case studies under it.”

One reorder call carries the entire tree, so the menu is never rendered in an intermediate state.

  • menu-get needs edit_theme_options
  • menu-items-reorder needs edit_theme_options

“Add the new pricing page to the footer.”

An item is created against the existing menu, with its label, target and parent stated.

  • menu-list needs edit_theme_options
  • menu-item-create needs edit_theme_options

“Which menu is actually the header on this theme?”

Theme locations are read and written explicitly, so the agent never guesses which registered location a menu fills.

  • menu-item-update needs edit_theme_options
  • menu-location-assign needs edit_theme_options
The shape of it

6 operations, 2 of them reads.

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.

Every operation, with its policy

Reads

2 operations that only report. A read still asks WordPress for a capability against the object.

Writes

4 that change something — each one previewed as a diff, snapshotted, verified by reading the site back, and reversible from wp-admin.

Tier

Free, permanently. Nothing in this area moves into a paid tier later.

The limit

What it will not do here.

Menu deletion is not exposed. Items can be created, retitled, moved and reordered; removing a whole menu is done in wp-admin.

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.

Next

Try it, or read further.

Get the free plugin How a write is guarded