add_management_page

函式
add_management_page ( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null )
引數
  • (string) $page_title The text to be displayed in the title tags of the page when the menu is selected.
    Required:
  • (string) $menu_title The text to be used for the menu.
    Required:
  • (string) $capability The capability required for this menu to be displayed to the user.
    Required:
  • (string) $menu_slug The slug name to refer to this menu by (should be unique for this menu).
    Required:
  • (callable) $callback Optional. The function to be called to output the content for this page.
    Required:
    Default: (empty)
  • (int) $position Optional. The position in the menu order this item should appear.
    Required:
    Default: null
返回值
  • (string|false) The resulting page's hook_suffix, or false if the user does not have the capability required.
定義位置
相關方法
add_comments_pageadd_menu_pageadd_theme_pageadd_submenu_pageadd_media_page
引入
1.5.0
棄用
-

add_management_page: 這個函式在WordPress管理選單中建立一個新的頂級管理頁面。你可以用它來為”工具”選單新增一個新的子選單項,例如,為你的WordPress網站建立一個自定義工具。

為工具主選單新增一個子選單頁面。

這個函式接受一個許可權,這個許可權將被用來決定一個頁面是否被包含在選單中。

鉤住處理頁面輸出的函式必須檢查使用者是否具有所需的許可權。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); }
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
	return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}

常見問題

FAQs
檢視更多 >