Title: unexpected T_FUNCTION
Last modified: August 21, 2016

---

# unexpected T_FUNCTION

 *  Resolved [Marcel Brown](https://wordpress.org/support/users/marcelbrown/)
 * (@marcelbrown)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/)
 * Updated to version 0.9.1. Now can’t activate plugin because of the following 
   error:
 * Parse error: syntax error, unexpected T_FUNCTION in /home/simplysm/public_html/
   wp-content/plugins/category-posts-in-custom-menu/category-posts-in-custom-menu.
   php on line 125
 * WordPress 3.8 with Genesis 2.02 and Serenity 1.02 child theme.
 * Any help would be appreciated. Thanks!
 * [http://wordpress.org/plugins/category-posts-in-custom-menu/](http://wordpress.org/plugins/category-posts-in-custom-menu/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/unexpected-t_function-1/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/unexpected-t_function-1/page/2/?output_format=md)

 *  [Jeremie.fr](https://wordpress.org/support/users/jeremiefr/)
 * (@jeremiefr)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496519)
 * Same problem here.
    I think this is because the module is now using closures 
   which can cause issues with php version prior to 5.3.
 * I modified my .htaccess to have a
    SetEnv PHP_VER 5_4 instead of SetEnv PHP_VER
   5
 * But the method can be different depend on your web server.
 *  [justbase](https://wordpress.org/support/users/justbase/)
 * (@justbase)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496536)
 * same here. and to modify my htaccess, without the setenv statement being in there
   in the first place, is not an option for me… Misschien weet je een oplossing 
   hiervoor Diana?
 *  [Joseph Kesisoglou](https://wordpress.org/support/users/joseph_kes/)
 * (@joseph_kes)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496595)
 * I have got the same issue.
 * >  Parse error: syntax error, unexpected T_FUNCTION in /www/blog/wp-content/plugins/
   > category-posts-in-custom-menu/category-posts-in-custom-menu.php on line 125
 * I tried removing lines 123-127, which I assume are only comments, but still no
   change. Also tried clean install through the wordpress environment – didn’t work–
   and finally I tried another clean installation by downloading the plugin to my
   client and then uploading to server via FTP – didn’t work either. In my situation
   it might be clashing with changes I made on the functions.php
    I hope one with
   greater php knowledge can debug this.
 * After all this experimentation wordpress deactivated the plugin automatically
   and upon manual activation it generates this:
 * > Plugin could not be activated because it triggered a fatal error.
 *  followed by the parse error.
 * [http://josephkesisoglou.co.uk/blog](http://josephkesisoglou.co.uk/blog)
    Theme:
   Descartes 1.2 (modified)
 *  [justbase](https://wordpress.org/support/users/justbase/)
 * (@justbase)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496602)
 * my suggestion is to download the previous version 0.9 and install that one. it
   worked for me and im a happy camper again…
 *  Thread Starter [Marcel Brown](https://wordpress.org/support/users/marcelbrown/)
 * (@marcelbrown)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496610)
 * I checked and the hosting for this site was using PHP 5.2. I had to edit the .
   htaccess file to use a newer PHP version and the problem is resolved. However,
   I would think that the plugin author would probably want to code a fallback for
   PHP 5.2 regardless.
 * Since I use HostGator, the following is all I had to add to my .htaccess file,
   which was easy to do with the WordPress SEO Plugin by Yoast.
 * # Use PHP 5.4
    AddType application/x-httpd-php54 .php
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496625)
 * Hi all,
 * thank you for your reports. My apologies that the new version is causing problems.
   I will investigate how to introduce a fallback for earlier PHP versions.
 * Kind regards,
    Diana
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496626)
 * Is someone willing and able to test code changes for me with an old version of
   PHP, before I commit a new version of the plugin?
 *  [justbase](https://wordpress.org/support/users/justbase/)
 * (@justbase)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496627)
 * im willing and able.
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496628)
 * justbase, thank you kindly!
 * I’ve added an if-else statement to switch between old and newer versions of PHP
   and have checked this in to the Development Version.
 * For anyone who is willing and able to test drive it: On the plugin homepage, 
   click ‘Developers’ and then under ‘Other Versions’, download the plugin .zip 
   by clicking ‘Developers Version’.
 * I’d love to hear your feedback. Again, my apologies for my inattentiveness with
   regards to PHP versions.
 * Kind regards,
    Diana
 *  [justbase](https://wordpress.org/support/users/justbase/)
 * (@justbase)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496640)
 * Parse error: syntax error, unexpected T_FUNCTION in /home2/pageinsb/public_html/
   wp-content/plugins/category-posts-in-custom-menu/category-posts-in-custom-menu.
   php on line 156
 *  [justbase](https://wordpress.org/support/users/justbase/)
 * (@justbase)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496641)
 * geen probleem om je te helpen met testen, i think the updated code works, but
   there seems to be a basic syntax error. no biggie
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496652)
 * I’m glad you offered to test. It seems that this way of switching versions doesn’t
   work, the offending code is still interpreted and causes the original error.
 * Thank you very much for your help. I’ve found some new reference material on 
   how to switch depending on the PHP version, will try to fix it before I go to
   work.
 * Kind regards,
    Diana
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496653)
 * I’ve applied the different way of switching versions.
    I’ve now added a cpcm-
   functions.php file and cpcm-functions52.php file, each defining the function 
   replace_dates in a different manner. The PHP require() function is called depending
   on the PHP version, thereby avoiding the aforementioned syntax error.
 * If someone could please re-test this with PHP 5.2 or below, I’d be very grateful.
   Please reinstall the complete plugin, not just the main .php file, because of
   the two newly added files.
 * Kind regards,
    Diana
 *  [themightyant](https://wordpress.org/support/users/themightyant/)
 * (@themightyant)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496657)
 * Hi Diana,
    the new dev version works fine on my server PHP 5.2.9. Thanks for 
   the plugin and update Regards Antony
 *  Plugin Author [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * (@anaid)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/#post-4496665)
 * Hi Antony,
 * thank you kindly for testing the new development version.
    Is there someone who
   can verify this please? Not out of doubt about Antony’s test, but just to be 
   sure.
 * Kind regards,
    Diana

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/unexpected-t_function-1/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/unexpected-t_function-1/page/2/?output_format=md)

The topic ‘unexpected T_FUNCTION’ is closed to new replies.

 * ![](https://ps.w.org/category-posts-in-custom-menu/assets/icon-128x128.png?rev
   =2539336)
 * [Category Posts in Custom Menu](https://wordpress.org/plugins/category-posts-in-custom-menu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/category-posts-in-custom-menu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/category-posts-in-custom-menu/)
 * [Active Topics](https://wordpress.org/support/plugin/category-posts-in-custom-menu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/category-posts-in-custom-menu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/category-posts-in-custom-menu/reviews/)

## Tags

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

 * 18 replies
 * 7 participants
 * Last reply from: [Diana van de Laarschot](https://wordpress.org/support/users/anaid/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/unexpected-t_function-1/page/2/#post-4496684)
 * Status: resolved