Title: Error with my-hacks.php
Last modified: August 18, 2016

---

# Error with my-hacks.php

 *  Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/)
 * When I add a hack to the my-hacks.php file I get the following error:
    Parse 
   error: parse error, unexpected T_FUNCTION in /home/shear/public_html/wordpress/
   my-hacks.php on line 3 What is going on? Can anyone help? Thanks, David.

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

 *  [TechGnome](https://wordpress.org/support/users/techgnome/)
 * (@techgnome)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-49382)
 * It might be helpful to know what is on that line. Sometimes this is due to a 
   missing semi-colon from the previous line(s). In this case it looks like it found
   something it wasn’t expecting in a place where it wasn’t supposed to be. If you
   post lines 1 – 5 of you file, I could give you a more difinitive answer.
    TG
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-49459)
 * Ok, the first 5 lines of the hack I was trying to install are below:
    function
   comment_plugger($before = ”, $limit = 5, $sep = ‘, ‘) { global $wpdb, $tablecomments,
   $id; $request = “SELECT comment_author, comment_author_url, MAX(comment_ID) as
   comment_ID FROM $tablecomments”; $request .= ” WHERE comment_post_ID=’$id’ AND
   comment_approved = ‘1’ GROUP BY comment_author, comment_author_url ORDER BY comment_ID
   DESC”; I got the hack from [http://wiki.wordpress.org/index.php/Comment%20Plugger](http://wiki.wordpress.org/index.php/Comment%20Plugger)
   Thanks, David
 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-49465)
 * I don’t see any errors in those 4 lines. Maybe try recopying the hack into my-
   hacks would be my only suggestion. I have the hack installed and it works fine.
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-49476)
 * I have tried doing that multiple times, I have noticed that it is doing it with
   every hack I try to install… every hack I try to install in my-hacks.php that
   error message comes up (or something simular). I am still getting:
    Parse error:
   parse error, unexpected T_FUNCTION in /home/shear/public_html/wordpress/my-hacks.
   php on line 2 any more suggestions?
 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-49526)
 * What are you using to edit my-hacks? Make sure it is not Notepad.
 *  Thread Starter Anonymous
 * [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50175)
 * Exactly the same problem with line 2 or3
    here is the hack : <? php function 
   get_recent_posts($no_posts = 5, $before = ‘
    - ‘, $after = ‘
    - ‘, $show_pass_post = false, $skip_posts = 0) {
       global $wpdb, $tableposts;
      $request = “SELECT ID, post_title FROM $tableposts WHERE post_status = ‘publish’“;
      if(!$show_pass_post) { $request .= “AND post_password =” “; } $request .= “
      ORDER BY post_date DESC LIMIT $skip_posts, $no_posts”; $posts = $wpdb->get_results(
      $request); $output = ”; foreach ($posts as $post) { $post_title = stripslashes(
      $post->post_title); $permalink = get_permalink($post->ID); $output .= $before.‘
      [‘ . $post_title . ‘](https://wordpress.org/support/topic/error-with-my-hacksphp/&apos; . $permalink . &apos;?output_format=md)‘.
      $after; } echo $output; } ?> I edited it with Edit Plus and Crimson… Any idea?
 *  [dansgirl165](https://wordpress.org/support/users/dansgirl165/)
 * (@dansgirl165)
 * [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50177)
 * On the very first line, take out the space between the ? and the “php” part. 
   I had the very same problem you had and once I took that space out, that fixed
   my problem. 🙂
 *  [nguetta](https://wordpress.org/support/users/nguetta/)
 * (@nguetta)
 * [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50179)
 * Gosh ! Thanks Dansgirl165 ! That was it 😉
 *  [dansgirl165](https://wordpress.org/support/users/dansgirl165/)
 * (@dansgirl165)
 * [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50182)
 * You’re welcome. 🙂
 *  [geekatwork](https://wordpress.org/support/users/geekatwork/)
 * (@geekatwork)
 * [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50199)
 * that space was so obvious i missed it, it’s the little things that get you, grrrrrrrrrrrrrrrrr

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

The topic ‘Error with my-hacks.php’ is closed to new replies.

 * 10 replies
 * 6 participants
 * Last reply from: [geekatwork](https://wordpress.org/support/users/geekatwork/)
 * Last activity: [22 years ago](https://wordpress.org/support/topic/error-with-my-hacksphp/#post-50199)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
