Ready to get started?Download WordPress


[resolved] HELP! Crashed site after editing a functions.php file (14 posts)

  1. zumadog
    Posted 2 years ago #

    I'm afraid I've really messed things up on my site after trying to add a short addition of code to the function.php file.

    Now I get this page when I try to call up the main home page;

    "Parse error: syntax error, unexpected '<' in /home/content/h/e/r/mypagename/html/wp-content/themes/yoko/functions.php on line 569"

    (where mypagename is substituted for the real name)

    I did copy/paste a copy of the original file into TextEdit program on my Mac, but when I re-pasted it after the original error occurred, I still get that error message. Now I have one page open to be able to edit the file to hopefully work again, but I don't know how long the page will stay open. All attempts to call up any pages end with that error message.

    I know the first thing anyone will ask is "did you back up the site before you made that edit?" Well, I thought just copying out the page to a text editor would be sufficient, and the whole site backup was the very next thing on my to-do list - naturally.

    I tried to count the lines to 659 but the file fell short of lines at about 630, and looking for a < is pretty ridiculous as they seem to be on every line.

    I could really use some expert advice on what to do, as I'm sure the page I have open in the php editor mode won't stay open for long.

  2. Hampton Paulk
    Posted 2 years ago #

    can you paste the code here?

  3. zumadog
    Posted 2 years ago #

    Here is the code:
    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. govpatel
    Posted 2 years ago #

    If you did not make many changes to functions.php file you can replace with a copy from your theme where as if you have added some other functions you will have edit the file with a editor on server or if you have one installed on your computer delete what ever function code you added and re upload

  5. Hampton Paulk
    Posted 2 years ago #

    I do not see any errors in the file that you pasted. Re upload this file and get a line number again. there are only 567 lines in the code you pasted. Also, what did you add to the original file, I would concentrate my efforts there.

  6. zumadog
    Posted 2 years ago #

    I'm afraid the only thing I can do is try and fix the text of the php file because all attempts to access any other pages lead me to the error message listed above. I still have that one page open and editable, but when I try to update it, it goes to the error message, but I can use the back arrow key to get back to it. Not so with trying to access any other pages within that open page of on a new browser window.

    I'm hoping I haven't lost all my posts, pages and links and have to start over from scratch because of an errant < symbol.

  7. zumadog
    Posted 2 years ago #

    Hampton, thanks for trying to help out.

    Here is the code I inserted, then deleted and tried to replace the original file with the copied file in TextEdit, I was trying to elimiate the word: "Private" from a private page.
    function bfa_remove_word_private($string) {
    $string = str_ireplace("private: ", "", $string);
    return $string;
    add_filter('the_title', 'bfa_remove_word_private');

    my site is http://www.herrschultz.com

  8. zumadog
    Posted 2 years ago #

    I'm beginning to think that I haven't been editing the functions.php file at all but that the edited file with the inserted text is what is existing on the server. Since I have the original file on hand, is there a way to directly edit it on my server? If so, this might be a solution. My site is hosted by Go Daddy.

  9. Hampton Paulk
    Posted 2 years ago #

    is this the first change you have ever made to the functions.php file?
    If you have made NO changes whatsoever to the original file, why not replace it with the original functions.php file from the theme. http://wordpress.org/extend/themes/yoko

  10. Hampton Paulk
    Posted 2 years ago #

    I do not use godaddy for hosting, but it looks like they will let you edit directly.

    Hope this helps you out zumadog

  11. zumadog
    Posted 2 years ago #

    Hampton, if you go to my site address in a browser you will get the error message on your screen that I listed above. I can't get to any pages on my site whatsoever even using the wp-admin address. It looks like the only way I can fix this is to edit the php file directly on the server if that's possible.

    I am open to any and all suggestions . . .

  12. zumadog
    Posted 2 years ago #


    What a nightmare. I was right, the file on the server was the corrupted one and so I used the backup copy I had in Text Edit and replaced it on the server.

    Site is back and working now, thanks for all the suggestions and attempts to help. It really made a difference.

  13. govpatel
    Posted 2 years ago #

    before you make any change get in habit to backup the file so that you can replace the file with backup.
    In functions.php file even dot in wrong place will break your website

  14. zumadog
    Posted 2 years ago #

    I am now in that habit! Luckily I had copy/pasted the entire file out to an external editor which I was able to fall back on.

    Backing up the server is my next chore.

    Thanks for your input.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.