wordpress函数add_users_page()

add_users_page( string $page_titlestring $menu_titlestring $capabilitystring $menu_slugcallable $function = int $position = null )

将子菜单页添加到用户/配置文件主菜单。
Add submenu page to the Users/Profile main menu.


说明(Description)

此函数具有用于确定菜单中是否包含页面的功能。

连接以处理页面输出的函数必须检查用户是否也具有所需的功能。


参数(Parameters)

参数 类型 必填 说明
$page_title (string) 必需 选择菜单时要在页面标题标记中显示的文本。
$menu_title (string) 必需 用于菜单的文本。
$capability (string) 必需 向用户显示此菜单所需的功能。
$menu_slug (string) 必需 用于引用此菜单的slug名称(对于此菜单应是唯一的)。
$function (callable) 可选 要调用以输出此页内容的函数。
$position (int) 可选 此项在菜单中的显示顺序。

返回(Return)

(string|false)结果页的hook_后缀,如果用户没有所需的功能,则为false。


源码(Source)

/**
 * Add sub menu page to the Users/Profile main menu.
 *
 * This function takes a capability which will be used to determine whether
 * or not a page is included in the menu.
 *
 * The function which is hooked in to handle the output of the page must check
 * that the user has the required capability as well.
 *
 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
 * @param string $menu_title The text to be used for the menu
 * @param string $capability The capability required for this menu to be displayed to the user.
 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
 * @param callback $function The function to be called to output the content for this page.
 *
 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
 */
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
    if ( current_user_can('edit_users') )
        $parent = 'users.php';
    else
        $parent = 'profile.php';
    return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function );
}

 

更新版本 源码位置 使用 被使用
5.3.0 wp-admin/includes/plugin.php:1566 0 2
版权声明:原创作品,未经允许不得转载,否则将追究法律责任。
本站资源有的自互联网收集整理,如果侵犯了您的合法权益,请联系本站我们会及时删除。
本站资源仅供研究、学习交流之用,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担。
本文链接:子佩工作室https://zptheme.com/5478.html
许可协议:《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权

本站分为普通会员,SVIP会员,永久会员。
SVIP会员新用户注册即送180天,到期后可邀请好友2位/180天进行无限续期。
永久会员支持微信支付在线开通。

积分是本站通用虚拟货币,可用于文章资源购买。
每天签到,评论或点赞文章,或者投稿都可免费获得积分
新用户注册免费赠送2积分 邀请用户注册2位/2积分

如果您已经成功付款但是网站没有弹出成功提示,请联系售后提供付款信息为您处理

本站资源属于虚拟商品,具有可复制性,可传播性,一旦授予,不接受任何形式的退款、换货要求。请您在购买获取之前确认好 是您所需要的资源

需要效果图的,可以联系售后(右侧核保售后,扫码添加或者点击 加入我们-联系客服)。或者微信添加企业微信:子佩工作室

计划书请提供费率条款(现价分红),100起。WP主题一般单个问题30起。主题二开500起,开发新主题3000起。低于1000须全款,其余先支付全款的60%,完成后支付余下的。

资源是指寿险计划书(定制除外),WP主题或插件不包含在永久会员之内!

发表回复