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
- Destination directory for file streaming does not exist or is not writable
- How to to secure WordPress file and folder permissions
- 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
- Network Admin “You do not have sufficient permissions to access this page.”
- 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
- How can I limit WordPress editor roles to a specific category?
- 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 can I set status=’publish’ for all featured images?
- How to check if a role has a specific capability
- 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?
- WordPress debug.log is not updating
- WordPress file permissions for editing on local Ubuntu development machine
- add_menu_page() for more than one user role
- current_user_can Not Always Working Properly
- Remove menu items from admin page and limit capabilities
- 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
- Are User Levels Still Currently Used?
- Permissions Issue with WordPress
- 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
- Iframe a WordPress template
- Roles for Custom Post Types
- How to configure apache to create files with correct group owner [closed]
- Moved my WordPress site and now it can’t read the theme
- WordPress folder ownership issues
- WordPress unable to create folders even though correct NTFS-rights are set
- 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?
- Safari not “giving Permission to Open This Page” when trying to load pdf from wordpress site [closed]
- 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
- You do not have sufficient permissions to access this page on a submenu
- Grant user rights to access certain tabs of a plugin
- Permissions in a Local Dev Environment (OS X)
- Running WordPress as FTP user?
- How to to secure WordPress file and folder permissions
- Upgrading problem
- Return scheduled posts with WP REST API
- wp-content Folder Permissions (777 OK?)
- Permission of 775 not enough
- failed to open stream: Permission denied for WordPress plugin
- How to prevent plugins from being uninstalled
- Implement Javascript Code in the footer if user is logged in
- Reseting file permissions
- What is the “user account” for WordPress’ file permissions?
- Auto-update failing with “hardened” permissions
- Restrict access to trash, only admin
- How to hide wordpress error message?
- Hiding custom theme functionality using capabilities
- 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
- “Backdoor-list.txt” files unexpectedly in server
- How to grant user access the page [closed]
- WordPress 4.4.2 Update not working
- Auto-Upgrade to 4.2.2 fails because theme functions.php is included instead of wp-includes/functions.php
- Plugin page and capabilities
- Unable to access custom plugin backend
- How to prevent people from seeing certain articles in menus?
- Configure Permissions in Mamp [closed]
- Edit draft from other author
- 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
- How to hide plugin options for editors via functions.php
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type