WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to activate a theme that works perfectly on one WordPress install. I have matched the plugins installed up and copied the theme over but when I go to activate it I get...

Fatal error: Call to undefined function add_menu_page() 

It points to the following line as being the cause of the error....

add_action('admin_menu', 'register_custom_menu');

function register_custom_menu() {
add_menu_page('Design', 'Design', 'delete_others_posts', '/nav-menus.php', '', get_stylesheet_directory_uri() . '/img/tv.png', '5.1' );
add_submenu_page( '/nav-menus.php', 'Widgets', 'Widgets', 'delete_others_posts', '/widgets.php', '' );
add_submenu_page( '/nav-menus.php', 'Nav Menu', 'Nav Menu', 'delete_others_posts', '/nav-menus.php', '' );
add_submenu_page( '/nav-menus.php', 'Event Options', 'Event Options', 'delete_others_posts', '/admin.php?page=mytheme-options', '' );

Can anyone see where I am going wrong?

share|improve this question
If this code is inside a class, you might need to change add_action('admin_menu', 'register_custom_menu'); to add_action( 'admin_menu', array( $this, 'register_custom_menu' ) );. – Pat J Apr 15 '13 at 14:46
Where is this code? Can you post it in context? – s_ha_dum Apr 15 '13 at 15:00
Have you matched the settings of the other, working WP install? A poorly built theme may throw an error if its settings are not set appropriately (IE opting to use a sidebar/menu or something similar). – vancoder Apr 15 '13 at 16:29
I still cannot comment :( please don't down-vote Could another plugin be calling your function, try changing the function's name, or wrapping add_menu_page in an if(function_exists( "add_menu_page" ) ) statement.? – Jamie Apr 15 '13 at 20:48
If the function already existed, it wouldn't throw a Call to undefined function ... error, but rather Cannot redeclare ..., no?! Am I missing something here? – Johannes Pille Apr 15 '13 at 20:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.