Title: Parse error: syntax error, unexpected T_FUNCTION
Last modified: August 20, 2016

---

# Parse error: syntax error, unexpected T_FUNCTION

 *  [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/)
 * I’m getting this error after I manually updated my wordpress to the latest version:
 * Parse error: syntax error, unexpected T_FUNCTION in D:\inetpub\vhosts\profitablehospitality.
   com\httpdocs\News\wp-includes\general-template.php on line 508
 *     ```
       function paginate_links($args = ''){
       	$defaults = array(
       		'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
       		'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
       		'total' => 1,
       		'current' => 0,
       		'show_all' => false,
       		'prev_next' => true,
       		'prev_text' => __('« Previous'),
       		'next_text' => __('Next »'),
       		'end_size' => 1,
       		'mid_size' => 2,
       		'type' => 'plain',
       		'add_args' => false, // array of query args to add
       		'add_fragment' => '');
   
       	$args = wp_parse_args( $args, $defaults );
       	extract($args, EXTR_SKIP);
   
       	// Who knows what else people pass in $args
       	$total = (int) $total;
       	if ( $total < 2 )
       		return;
       	$current  = (int) $current;
       	$end_size = 0  < (int) $end_size ? (int) $end_size : 1; // Out of bounds?  Make it the default.
       	$mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
       	$add_args = is_array($add_args) ? $add_args : false;
       	$r = '';
       	$page_links = array();
       	$n = 0;
       	$dots = false;
   
       	if ( $prev_next && $current && 1 < $current ) :
       		$link = str_replace('%_%', 2 == $current ? '' : $format, $base);
       		$link = str_replace('%#%', $current - 1, $link);
       		if ( $add_args )
       			$link = add_query_arg( $add_args, $link );
       		$link .= $add_fragment;
       		$page_links[] = '<a href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $prev_text . '</a>';
       	endif;
       	for ( $n = 1; $n <= $total; $n++ ) :
       		$n_display = number_format_i18n($n);
       		if ( $n == $current ) :
       			$page_links[] = "<span class='page-numbers current'>$n_display</span>";
       			$dots = true;
       		else :
       			if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
       				$link = str_replace('%_%', 1 == $n ? '' : $format, $base);
       				$link = str_replace('%#%', $n, $link);
       				if ( $add_args )
       					$link = add_query_arg( $add_args, $link );
       				$link .= $add_fragment;
       				$page_links[] = "<a>$n_display</a>";
       				$dots = true;
       			elseif ( $dots && !$show_all ) :
       				$page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>';
       				$dots = false;
       			endif;
       		endif;
       	endfor;
       	if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
       		$link = str_replace('%_%', $format, $base);
       		$link = str_replace('%#%', $current + 1, $link);
       		if ( $add_args )
       			$link = add_query_arg( $add_args, $link );
       		$link .= $add_fragment;
       		$page_links[] = '<a href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
       	endif;
       	switch ( $type ) :
       		case 'array' :
       			return $page_links;
       			break;
       		case 'list' :
       			$r .= "<ul class='page-numbers'>\n\t
       <li>";
       			$r .= join("</li>
       \n\t
       <li>", $page_links);
       			$r .= "</li>
       \n\n";
       			break;
       		default :
       			$r = join("\n", $page_links);
       			break;
       	endswitch;
       	return $r;
       }
       ```
   
 * Please help!

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

 *  [Abhishek Ghosh](https://wordpress.org/support/users/abhishek_ghosh/)
 * (@abhishek_ghosh)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274958)
 * unexpected T_FUNCTION is a PHP error, not actually only error of “WordPress”.
 * Probably your Theme or a plugin is calling some arguments. Replace `general-template.
   php` by downloading it from codex to ensure that it is not corrupted; switch 
   to WordPress 3.5 ‘s default theme, deactivate all the plugins.
 * You can see it happened with someone in older version too : [http://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_functionline-11?replies=5](http://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_functionline-11?replies=5)
 *  Thread Starter [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274961)
 * Where can I exactly download general-template.php? I have deactivated all plugins
   before I upgraded wordpress. I can’t log in because the error is showing on the
   page.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274962)
 * Try re-uploading all files & folders – **except** the wp-content folder – from
   a **fresh** download of WordPress. Make sure that you delete the old copies of
   files & folder before uploading the new ones.
 *  Thread Starter [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274966)
 * I tried re-uploading them. Now this is showing:
 * Warning: require(D:\inetpub\vhosts\profitablehospitality.com\httpdocs\News/wp-
   includes/class-wp-theme.php) [function.require]: failed to open stream: No such
   file or directory in D:\inetpub\vhosts\profitablehospitality.com\httpdocs\News\
   wp-settings.php on line 111
 * Fatal error: require() [function.require]: Failed opening required ‘D:\inetpub\
   vhosts\profitablehospitality.com\httpdocs\News/wp-includes/class-wp-theme.php’(
   include_path=’.;./includes;./pear’) in D:\inetpub\vhosts\profitablehospitality.
   com\httpdocs\News\wp-settings.php on line 111
 * This is the line 111
    `require( ABSPATH . WPINC . '/class-wp-theme.php' );`
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274967)
 * You still have corrupted core files. Re-upload all files & folders – **except
   the wp-content folder** – from a **fresh download** of WordPress.
 * **Make sure that you delete the old copies of files & folder before uploading
   the new ones.**
 *  Thread Starter [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274968)
 * That’s what I did. But I was able to fix that one. Apparently, filezilla didn’t
   upload class-wp-theme.php
 * But now this is showing:
 * Fatal error: Cannot redeclare get_query_template() (previously declared in D:\
   inetpub\vhosts\profitablehospitality.com\httpdocs\News\wp-includes\theme.php:
   745) in D:\inetpub\vhosts\profitablehospitality.com\httpdocs\News\wp-includes\
   template.php on line 30
 * This is the code:
 *     ```
       function get_query_template( $type, $templates = array() ) {
       	$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
   
       	if ( empty( $templates ) )
       		$templates = array("{$type}.php");
   
       	return apply_filters( "{$type}_template", locate_template( $templates ) );
       }
       ```
   
 * This is liine 30:
    `}’
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274969)
 * Still corrupted core files. Either there’s a problem with your download link 
   via your ISP or an issue with your upload via FTP.
 *  Thread Starter [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274971)
 * I was finally able to update my database and I was able to log in. But after 
   logging in, this is now showing:
 * Fatal error: Call to undefined method WP_Screen::in_admin() in D:\inetpub\vhosts\
   profitablehospitality.com\httpdocs\News\wp-includes\load.php on line 625
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274972)
 * Sorry – still corrupted core files.
 *  Thread Starter [christinekimc](https://wordpress.org/support/users/christinekimc/)
 * (@christinekimc)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274973)
 * That error is showing when I try to go to [http://www.profitablehospitality.com/news/wp-admin](http://www.profitablehospitality.com/news/wp-admin)
 * The website is okay. I can’t just get inside the back end
 * This is the code:
    function is_network_admin() { if ( isset( $GLOBALS[‘current_screen’]))
   return $GLOBALS[‘current_screen’]->in_admin( ‘network’ ); elseif ( defined( ‘
   WP_NETWORK_ADMIN’ ) ) return WP_NETWORK_ADMIN;
 *  return false;
    }
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274976)
 * Guess what – corrupted files. 🙁 Can you try the upload using another FTP client?
   Or another computer?
 *  [Abhishek Ghosh](https://wordpress.org/support/users/abhishek_ghosh/)
 * (@abhishek_ghosh)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274978)
 * You will get the individual files from sub version : [http://core.svn.wordpress.org/trunk/](http://core.svn.wordpress.org/trunk/)
   
   But, it seems the whole package is corrupted like esmi said.
 * If you are using Windows PC, make sure that you do not have virus, malwares. 
   etc on your PC.
    If it is Windows, download the GNU wget for Windows : [http://www.gnu.org/software/wget/](http://www.gnu.org/software/wget/)
   wget WordPress from WordPress.org (means here) via command line (delete the old
   download) to avoid browser based download, uncompress and upload it after stripping
   the folders like Esmi said and obviously the wp-config.php file. Something is
   breaking the files, but what that is, its difficult to say from this end.
 * Take a backup of MySQL Database via PHPMyAdmin and keep a backup of that uploads
   folder. You will usually have the pictures and uploaded media there. In extreme
   case, you might have to delete everything and install freshly.

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

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

## Tags

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

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 12 replies
 * 3 participants
 * Last reply from: [Abhishek Ghosh](https://wordpress.org/support/users/abhishek_ghosh/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-t_function-3/#post-3274978)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
