WordPress site and navigation tool reference
Twelve tools covering three areas: site information and options, navigation menus, and SEO metadata.
Site and options
| Tool | Does | Write |
|---|---|---|
wp_get_site_info |
Public site metadata | |
wp_get_option |
Read an allowlisted option | |
| Supported plugin settings | Use feature contracts; generic option dumps are unavailable | |
wp_update_option |
Write an allowlisted option | Yes |
Navigation menus
| Tool | Does | Write |
|---|---|---|
wp_get_menus |
List menus | |
wp_get_menu_items |
List a menu's items | |
wp_create_menu_item |
Add an item | Yes |
wp_update_menu_item |
Change an item | Yes |
wp_delete_menu_item |
Remove an item | Yes |
wp_reorder_menu_items |
Change the order | Yes |
SEO metadata
| Tool | Does | Write |
|---|---|---|
wp_get_seo_meta |
Read Yoast and Rank Math fields | |
wp_update_seo_meta |
Write them | Yes |
Three different permission models
This is the chapter where the permissions diverge most, so it is worth stating up front.
| Area | Capability | Write gate |
|---|---|---|
| Site info | None | — |
| Option reads | manage_options for plugin settings; none for wp_get_option |
— |
| Option writes | manage_options |
Allow option writes |
| Menus | edit_theme_options |
Allow content writes |
| SEO meta | edit_post on the post |
Allow content writes |
Option writes are the only tools in the WordPress groups behind the option gate rather than the content gate. That separation is deliberate: editing a post is routine, changing a site-wide setting is not.
Menus sit behind edit_theme_options, a higher bar than editing posts — worth remembering when choosing which user approves an OAuth authorization.
Options are tightly allowlisted
Only a handful of options can be read, and fewer can be written. Everything else is refused, and any option whose name looks like a credential is refused regardless.
See wp_get_option and wp_update_option for the exact lists.
Menus appear on every page
A menu mistake is visible site-wide within seconds, which makes reading before writing more valuable here than anywhere else in the WordPress groups.
Menus are also hierarchical, and the item listing does report parent — unlike taxonomy listings, which report no hierarchy at all. Use it.
Deleting a menu item is permanent: it does not go to the trash.
SEO fields are per-post, not site settings
Despite sitting in this chapter, the SEO tools operate on a single post's metadata. They are grouped here because they belong to the same "how the site presents itself" concern.
They write both Yoast and Rank Math fields without checking which plugin is active — see wp_update_seo_meta.
Related
- Edit a navigation menu
- Update an allowed public setting
- Configure POM Theme settings for theme options, which are separate