Title: Warning: call_user_func_array() expects parameter 1
Last modified: October 4, 2016

---

# Warning: call_user_func_array() expects parameter 1

 *  [rwvanleer](https://wordpress.org/support/users/rwvanleer/)
 * (@rwvanleer)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/warning-call_user_func_array-expects-parameter-1-4/)
 * 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 524
 * Here 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.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [implenton](https://wordpress.org/support/users/implenton/)
 * (@implenton)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/warning-call_user_func_array-expects-parameter-1-4/#post-8252859)
 * Hello [@rwvanleer](https://wordpress.org/support/users/rwvanleer/),
 * with `add_action( ‘init’, ‘register_my_menus’ );` you are calling the `register_my_menus`
   function which is not defined – at least it does not appear in the code you pasted
   here.
 * What you have to do is add the `register_nav_menus` into the function you specified:
 *     ```
       register_nav_menus( array(
           ‘primary’ => esc_html__( ‘Primary’, ‘cedargold’ ),
           ‘cgls’ => esc_html__( ‘Labs’, ‘cedargold’ ),
           ‘cgac’ => esc_html__( ‘Accountable’, ‘cedargold’ ),
       ) );
       ```
   
 * like this:
 *     ```
       function register_my_menus() {
   
           register_nav_menus( array(
               ‘primary’ => esc_html__( ‘Primary’, ‘cedargold’ ),
               ‘cgls’ => esc_html__( ‘Labs’, ‘cedargold’ ),
               ‘cgac’ => esc_html__( ‘Accountable’, ‘cedargold’ ),
           ) );
   
       }
       ```
   
 * > Again it works correct in local environment, no warnings.
 * You might have different error reporting set on your local and live/staging site.
 * [https://codex.wordpress.org/Debugging_in_WordPress#PHP_Errors.2C_Warnings.2C_and_Notices](https://codex.wordpress.org/Debugging_in_WordPress#PHP_Errors.2C_Warnings.2C_and_Notices)
    -  This reply was modified 9 years, 8 months ago by [implenton](https://wordpress.org/support/users/implenton/).
 *  Thread Starter [rwvanleer](https://wordpress.org/support/users/rwvanleer/)
 * (@rwvanleer)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/warning-call_user_func_array-expects-parameter-1-4/#post-8255197)
 * Thank you for the insight Implenton. I appreciate you expertise. I will go forward
   and see what I can do from here.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Warning: call_user_func_array() expects parameter 1’ is closed to new
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [rwvanleer](https://wordpress.org/support/users/rwvanleer/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/warning-call_user_func_array-expects-parameter-1-4/#post-8255197)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
