WP needs all the required arguments – you skipped the one that tells it either a PHP file to use for output, or a function to run.
From the Developer Site:
/**
* Register a custom menu page.
*/
function wpdocs_register_my_custom_menu_page(){
add_menu_page(
__( 'Custom Menu Title', 'textdomain' ),
'custom menu',
'manage_options',
'custompage',
'my_custom_menu_page',
plugins_url( 'myplugin/images/icon.png' ),
6
);
}
add_action( 'admin_menu', 'wpdocs_register_my_custom_menu_page' );
/**
* Display a custom menu page
*/
function my_custom_menu_page(){
esc_html_e( 'Admin Page Test', 'textdomain' );
}
The 5th argument in add_menu_page()
is the name of a custom function, which is then defined below.
Related Posts:
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- How To Activate Plugins via Code?
- Activate a plugin through PHPMyAdmin or FTP?
- How to check if a theme is active?
- Pluggable function and activation check?
- Automatically install wordpress plugin at theme activation
- Show a confirm message before plug-in activation
- Function to activate WordPress theme inside a plugin
- Activate Plugin which is in subfolder?
- explanation for activate_plugin function in wordpress core
- Remote plugin activation hook
- Force plugin to fail activation
- WordPress register_activation_hook table creation not working
- Multisite: Activate plugin for subsites only?
- The plugin generated x characters of unexpected output, $wpdb not defined
- Correct way to use register_activation_hook
- Cannot run the code after I activate the plugin
- wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation
- Unable to activate wordpress importer after installing it
- How to include plugin without activation?
- Auto add content such as pages upon plugin activation?
- Detect when any plugin is activated or deactivated
- How to automate wordpress plugin activate and deactivate by php logic?
- Default Plugin Settings Not Writing to Database
- Plugin won’t activate – cannot declare class (already in use)
- Plugin Deactivate Self on Activation Errors
- How to activate plugins for my WordPress sites from a remote server
- register_activation_hook with include file [closed]
- Prevent a plugin from being automatically activated
- Is any information available in PHP files in WP about plugin activation history?
- Activated plugin is stored as an object, rather than as a path
- Own plugin corrups plugin-activation
- How to check if tables in WordPress still exists after activations
- How to block plugin activations with no known user or coming from unknown IP address range?
- Run plugins only on certain pages
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Force file download on plugin activation
- WordPress user account activation
- Multiple instance of data in plugin custom database table on plugin activation
- Why this function not working for install database on plugin activation
- register_activation_hook in oop approach
- How to create multiple database tables on plugin activation?
- Run function on plugin activation before plugin is loaded
- A question about register_activation hook
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- Sub Plugin deactivation when Parent Plugin deactivate
- Advanced WordPress plugin activation detection
- Apparent errer when installing plugin
- Activate a plugin via a SQL query
- My plugin does not install correctly if a previous version is still installed
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- Activation flow of a plugin in a multisite environment
- How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin
- How to check for already existing plugin versions on activation? and prevent errors
- how to enable/activate a plugin per Cpanel
- My WordPress activation hook isn’t working
- Cannot modify header information – headers already sent during plugin activation
- Error Copying Directory On Plugin Activation
- WordPress hook source
- API calls on plugin activation or init?
- Different plugins activated online and offline
- Problems with installing and deleting plugins
- Plugin De/Activation Not Firing On MultiSite install
- Custom Table doesn’t create on plugin activation
- Activate plugins by a theme’s functions.php?
- Is it possible to send user new password after they clicking on forgot password in word press
- why i cannot see some plugins while they are enabled on network admin page?
- Install theme as part of a plugin
- Recommendationf for Quiz Plugin that saves results [closed]
- shortcode doesn’t work
- Will WordPress username displayed somewhere in the site?
- upgrade plugin in wordpress
- Are Drop-ins harmful for wordpress website?
- Where to hook my plugin’s action
- load_theme_textdomain path
- How to update plugins with database updates if I use svn
- Why WordPress plugin url ajax doesn’t work?
- How to add wp visual editor in a custom widget?
- allow photo/video in comments
- Can’t get Gutenberg InspectorControls to work
- How to change the wp_upload_dir() path in plugin
- How can I redirect some pages to new subdomain? [closed]
- How to create wordpress page that lets users create their own quiz? [closed]
- How to reinstate previously saved option?
- Can’t create new CPTs when menu hidden
- Google Appointments in WordPress?
- Codeless random token generation to pass into multiple tracking links in a single page load
- Display a number value from mysql query in WP
- How can I show login popup when user clicks on download button
- Adding javascript to header of MetroMagazine theme
- How to Save settings of custom tab product page in admin side in a database?
- Unable to Retrieve Setting Value for my Plugin
- galleria for WordPress not working properly on Mobile devices (responsive)?
- Get plugin versions in xml/json format
- Make a wordpress site similar to Hot Or Not – Image rating system [closed]
- How to submit readme.txt file in wordpress directory
- How to create plugin list groups?
- WordPress Code Access to Restricted Content without Registration
- How to pre-set WordPress settings for specific posts?
- Two sites one PC