You want the admin_menu
hook, rather than admin_init
.
Also, you shouldn’t use anonymous functions. Instead, use:
function wpse51004_add_menu_page() {
add_menu_page('Some Page', 'Some Page', 'manage_options', 'some-slug', 'wpse51004_some_page_callback');
};
add_action('admin_menu', 'wpse51004_add_menu_page');
function wpse51004_some_page_callback() {
echo 'Hello, world!';
}
Related Posts:
- Applying roles to an admin sub-menu (eg Appearance -> Menus)
- MySQL error 1449: The user specified as a definer does not exist
- What is valid timing of using current_user_can() and related functions?
- WP in Docker – cannot install plugin or upgrade WP
- when FS_METHOD = ‘direct’ is chosen?
- Create custom permissions for user type
- WordPress REST API – Permission Callbacks
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- Can’t upload images due to permissions error
- Disable posts, only allow to edit existing pages, not create new ones (create_posts)
- Recommended File Permissions
- What’s the difference between the permissions “edit_published_posts” and “edit_posts”
- Wrong permissions when uploading a file through WordPress | IIS
- ftp_nlist() and ftp_pwd() warnings
- WordPress in IIS 7.5 – “cannot create directory”
- What permissions should i have set up for the Database User after i have WordPress set up?
- Why is group ownership with rwx permissions not enough?
- Editing WordPress Permissions in LAMP – Ubuntu 11.10
- can i run wp as root permissions
- Is there a simple way to manage capabilities per user?
- Prevent or Disable creating new users or changing roles of existing users to Administrator
- Safe to set permissions to 757 temporarily to update via wp-cli?
- How to change menu page capability
- How to remove sticky post capability for a specific user role?
- Multiple Authors on Single Post
- Does WordPress have fine-grained view permissions?
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- add_menu_page() for more than one user role
- current_user_can Not Always Working Properly
- Remove wordpress author’s capability to moderate comments on their own posts
- Can you set a role as author?
- Troubleshoot “You do not have sufficient permissions to access this page.”
- plugin install wants ftp (chown and 755 not enough)
- can’t change footer
- permissions access error
- What user/group does WordPress belong to in terms of file permissions?
- Enable plugin installs without FTP with user from same group as Nginx/PHP-fpm
- Roles for Custom Post Types
- Moved my WordPress site and now it can’t read the theme
- WordPress folder ownership issues
- WordPress php mysql errors – errcode: 13 permission denied
- read_post meta capability for anonymous users
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Admin cannot publish
- Invalid changeset UUID WordPress
- Group ownership permissions don’t allow web server to update WordPress content
- Should Apache own /var/www/domain.com directory in WordPress?
- WordPress Permissions on my Local with Docker
- Grant user rights to access certain tabs of a plugin
- Running WordPress as FTP user?
- How to to secure WordPress file and folder permissions
- Upgrading problem
- wp-content Folder Permissions (777 OK?)
- Permission of 775 not enough
- How to prevent plugins from being uninstalled
- Reseting file permissions
- What is the “user account” for WordPress’ file permissions?
- Restrict access to trash, only admin
- How to hide wordpress error message?
- What is this error message?
- Which wordpress should be obligatory writeable?
- User Capabilities are not available in WP REST permission callback?
- Prevent all users from editing posts except admins using hooks
- How to grant user access the page [closed]
- WordPress 4.4.2 Update not working
- Plugin page and capabilities
- Unable to access custom plugin backend
- How to prevent people from seeing certain articles in menus?
- How to let a role handle media without post permissions
- How to add only a (sub) capacity to an user role?
- Auto-Update Fails
- insufficient permissions; coding an action for plugin governed by custom capability
- Set edit capability based on ACF relationship
- See which user role / capability is needed to use a plugin
- How to make file not open to public but javascript file under WordPress folder can load it
- Allow Editor access to a certain plugin
- Visitors “do not have permission to view this content” on home page only
- Permissions Script Not Working
- WordPress does not have the permission to update (IspConfig)
- Blank White page issue in WordPress
- Permissions working but not working
- Mamp Pro File Permissions
- Create a custom “you dont have permission” message
- How to put WordPress website behind the credential for visitors?
- Downloaded WP but Nginx home page still showing
- Public and Private keys incorrect for user
- How to add a menu page for options in wordpress for user that has the role of vendor?
- Force “submit for review” on update?
- sufficient permissions to access this page
- Uploaded files have permission 000
- Restrict access to specific content
- the_tags only showing when logged in?
- Configuring WordPress permissions for easy updates
- Plugins Page – “Page disabled by the administrator”
- How to give access to programmer/developer to make changes, but prevent undesirable changes? [closed]
- How might I enable a user to view Draft pages from a different Author, without the ability to edit?
- How do I share a Git repository with multiple users on a machine?
- Amazon Cloudfront with S3. Access Denied
- Postgresql: what does GRANT ALL PRIVILEGES ON DATABASE do?
- WP Permission still set to Not Writable after I change the permission for the whole folder and files