You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/wp-build/README.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -248,15 +248,17 @@ WP-Admin mode integrates within the standard WordPress admin interface (keeping
248
248
249
249
```php
250
250
add_submenu_page(
251
-
'themes.php', // Parent menu
252
-
__( 'My Page', 'my-plugin' ), // Page title
253
-
__( 'My Page', 'my-plugin' ), // Menu title
254
-
'edit_theme_options', // Capability
255
-
'my-admin-page-wp-admin', // Menu slug (simple)
256
-
'my_admin_page_wp_admin_render_page' // Callback from generated PHP
251
+
'themes.php', // Parent menu
252
+
__( 'My Page', 'my-plugin' ), // Page title
253
+
__( 'My Page', 'my-plugin' ), // Menu title
254
+
'edit_theme_options', // Capability
255
+
'my-admin-page-wp-admin', // Menu slug (simple)
256
+
'my_plugin_my_admin_page_wp_admin_render_page' // Callback from generated PHP (prefixed)
257
257
);
258
258
```
259
259
260
+
Note: The callback function name is prefixed with your plugin name (from `wpPlugin.name` in root `package.json`). For example, if your plugin name is `my-plugin`, the function will be `my_plugin_my_admin_page_wp_admin_render_page`.
261
+
260
262
The page slug is `my-admin-page-wp-admin` (your page ID + `-wp-admin`). WordPress routes all requests to this callback, and the JavaScript router handles internal navigation.
261
263
262
264
**Deep linking with the `p` query parameter:**
@@ -274,7 +276,7 @@ When the page loads, the JavaScript boot system reads the `p` parameter and navi
274
276
Full-page mode takes over the entire admin screen with a custom sidebar:
0 commit comments