Title: Parse error: T_ENDFOREACH
Last modified: August 22, 2016

---

# Parse error: T_ENDFOREACH

 *  [meryl](https://wordpress.org/support/users/meryl/)
 * (@meryl)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/)
 * This is for a nonprofit org’s website. I just inherited and saw this error:
 * Parse error: syntax error, unexpected T_ENDFOREACH in comments.php on line 45.
 * Line 45 would be:
 * `<?php endforeach /* end for each comment */ ?>`
 * I search that code and the error message, but didn’t find solutions that worked.
   Any help appreciated!
 * [Large code excerpt removed by moderator per [forum rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use [the pastebin](http://wordpress.pastebin.com/) for all large code 
   excerpts. It works better anyway.]

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

 *  [Craig Ralston](https://wordpress.org/support/users/craig-ralston/)
 * (@craig-ralston)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5195976)
 * What were you doing when you saw this error? Is it showing up in the front end
   or you see it in your error logs?
 *  Thread Starter [meryl](https://wordpress.org/support/users/meryl/)
 * (@meryl)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5195981)
 * It shows up on a blog entry’s page (page.php). It also screws up the admin menu
   at the top (hidden) yet post shows “edit this entry”.
 * Didn’t see anything in page.php either.
 * [Here’s the comment.php code](http://pastebin.com/dRNyAzPn)
 *  [Craig Ralston](https://wordpress.org/support/users/craig-ralston/)
 * (@craig-ralston)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5195986)
 * Please try deactivating plugins to rule out any plugin-related issues and activate
   an unmodified default theme to rule out theme-related issues. What WordPress 
   version are you on?
 *  Thread Starter [meryl](https://wordpress.org/support/users/meryl/)
 * (@meryl)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5195988)
 * No change after deactivating all plugins.
 * Narrowed down to a theme issue. Changing themes made error disappear.
 * v3.9.2
 * Wow, Jetpack won’t even connect to wordpress.com. Says site_inaccessible. Deactivating
   Jetpack changed nothing.
 *  Thread Starter [meryl](https://wordpress.org/support/users/meryl/)
 * (@meryl)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5196150)
 * How is the error in the theme? Usually theme is just .css not .php?
 *  [webbrewers](https://wordpress.org/support/users/webbrewers/)
 * (@webbrewers)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5196152)
 * Themes contain all the front end page php files.
 *  Thread Starter [meryl](https://wordpress.org/support/users/meryl/)
 * (@meryl)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5196274)
 * I fixed it by copying 2014 theme into the Dead Silent theme while retaining the
   top portion of Dead Silent. Theme works well for our purposes. The others don’t
   feel the style or require a lot of tweaking to fix. Hence the reason we prefer
   to stick with an older theme.

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

The topic ‘Parse error: T_ENDFOREACH’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [meryl](https://wordpress.org/support/users/meryl/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-t_endforeach/#post-5196274)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
