Fatal error : Call to undefined function add_menu_page()
If you want to add menu to admin section of wordpress through custom plugin and you got
"Fatal error : Call to undefined function add_menu_page() " error.
Then reason for error might be there is no add_action function found in plugin
Try this code to solve this error in your plugin file.
<?php
/*
Plugin Name: Myplugin
Description:
Version: 2.5.324
Author: Amit kumar
*/
add_action('admin_menu', 'test');
function test(){
add_menu_page(__('My Menu Page'), __('My Menu'), 'edit_themes', 'my_new_menu', 'my_test_function', '', 7);
}
function my_test_function(){
echo "hello world .. !!";
}
If you want to add menu to admin section of wordpress through custom plugin and you got
"Fatal error : Call to undefined function add_menu_page() " error.
Then reason for error might be there is no add_action function found in plugin
Try this code to solve this error in your plugin file.
<?php
/*
Plugin Name: Myplugin
Description:
Version: 2.5.324
Author: Amit kumar
*/
add_action('admin_menu', 'test');
function test(){
add_menu_page(__('My Menu Page'), __('My Menu'), 'edit_themes', 'my_new_menu', 'my_test_function', '', 7);
}
function my_test_function(){
echo "hello world .. !!";
}
No comments:
Post a Comment