我正在使用 wp 的 add_submenu_page 函数在父菜单中添加子菜单,但是在访问该子菜单时出现此错误:
抱歉,您无权访问此页面。
我以管理员身份登录,刷新永久链接并注销然后登录,但没有任何变化。
我的代码:
class SPSetup {
public function reg_func() {
add_action( 'admin_menu', array( $this, 'sp_menu', ) );
}
public function sp_menu() {
add_submenu_page(
'montheme_options', 'SP Dashboard', 'SP Dashboard',
'manage_options', 'sp-control',
array( $this, 'callback' )
);
}
}
if ( class_exists( 'SPSetup ' ) ) {
$SP= new SPSetup ();
$SP->reg_func();
}
Run Code Online (Sandbox Code Playgroud) wordpress ×1