Title: Parse error: syntax error, unexpected &#039;function&#039; (T_FUNCTION)
Last modified: August 30, 2016

---

# Parse error: syntax error, unexpected 'function' (T_FUNCTION)

 *  [Pcosta88](https://wordpress.org/support/users/pcosta88/)
 * (@pcosta88)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-function-t_function/)
 * Theme: Current updated 2013 Theme
    WordPress: 4.4 the newest PHP: I assume since
   I updated to the newest WP it is also updated to the newest PHP Hosting: Local
   host on computer using XAMPP.
 * Error: Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /Applications/
   XAMPP/xamppfiles/apps/wordpress/htdocs/wp-content/themes/twentythirteenChild/
   functions.php on line 578
 * Code is placed in functions.php. Not sure I am getting this error message. My
   function looks correct but it throws out the above error. When I remove this 
   code functions.php works fine.
    I don’t think my code is a problem (or maybe 
   it is?) so I am hoping a second set of eyes or some suggestions would help solve
   this error.
 * Code
 *     ```
       <?php
       function register_my_menus() {  //line 578
       	register_nav_menus (
       		array(
       			'footer-menu' => __('Footer Menu')
       			)
       		);
       }
       add_action('init', 'register_my_menus');
       ?>
       ```
   

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

 *  [WEN Solutions](https://wordpress.org/support/users/wen-solutions/)
 * (@wen-solutions)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-function-t_function/#post-6833103)
 * Hello [@pcosta88](https://wordpress.org/support/users/pcosta88/),
    Your codes
   look fine and it is working well for me in WordPress 4.4. Please try changing
   the theme and us the above code in that theme. Thanks!
 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-function-t_function/#post-6833327)
 * I’ll bet if you get rid of the **<?php** at the start, and the **?>** at the 
   end, the code will work perfectly. 🙂 Here’s a cleaned-up version of your code:
 *     ```
       function register_my_menus() {
       	register_nav_menus(array(
       		'footer-menu' => __('Footer Menu'),
       	));
       }
       add_action('init', 'register_my_menus');
       ```
   
 *  Thread Starter [Pcosta88](https://wordpress.org/support/users/pcosta88/)
 * (@pcosta88)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-function-t_function/#post-6833348)
 * Super weird,
 * I cut out the code that was bothersome, saved the functions.php, then put the
   code back in, saved it, restarted my XAMPP…and the error message went away.
 * ¯\_(ツ)_/¯
 * Thanks for all the suggestions!

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

The topic ‘Parse error: syntax error, unexpected 'function' (T_FUNCTION)’ is closed
to new replies.

## Tags

 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)
 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 3 replies
 * 3 participants
 * Last reply from: [Pcosta88](https://wordpress.org/support/users/pcosta88/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-function-t_function/#post-6833348)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
