Warning: call_user_func_array() expects parameter 1
-
I had been creating a site on my local host and created an array of menus to use based on the page template I have used. It the local environment it all worked fine, however when I uploaded the site I got the following warning showing up at the top of my pages:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘register_my_menus’ not found or invalid function name in /home2/rwvanleer/public_html/cedargoldmedical.com/wp-includes/plugin.php on line 524Here is a brief run down of what I did.
In the functions.php page I added the following:
register_nav_menus( array(
‘primary’ => esc_html__( ‘Primary’, ‘cedargold’ ),
‘cgls’ => esc_html__( ‘Labs’, ‘cedargold’ ),
‘cgac’ => esc_html__( ‘Accountable’, ‘cedargold’ ),
) );
add_action( ‘init’, ‘register_my_menus’ );Once this was complete I added the following statement into the header.php file:
<nav id=”site-navigation” class=”main-navigation” role=”navigation”>
<button class=”menu-toggle” aria-controls=”primary-menu” aria-expanded=”false”><?php esc_html_e( ‘Menu’, ‘cedargold’ ); ?></button>
<?php
if ( is_page_template( ‘page-labs.php’)) { ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘cgls’, ‘menu_id’ => ‘primary-menu’ ) ); ?>
<?php
} elseif ( is_page_template( ‘page-ac.php’)) { ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘cgac’, ‘menu_id’ => ‘primary-menu’ ) ); ?>
<?php
} elseif ( is_page_template( ‘page-home.php’)) { ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_id’ => ‘primary-menu’ ) ); ?>
<?php
} else { ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_id’ => ‘primary-menu’ ) ); ?>
<?php
}
?>
</nav><!– #site-navigation –>Again it works correct in local environment, no warnings.
I would greatly appreciate any insights on how to correct this.
The topic ‘Warning: call_user_func_array() expects parameter 1’ is closed to new replies.