• Resolved tmcdonald100

    (@tmcdonald100)


    Hi,

    Relatively new to this…..
    I tried to insert some code into the functions.php file in the editor part of WP and i got this error back on a blank screen:
    Parse error: syntax error, unexpected ‘<‘ in C:\xampp 1\htdocs\wp\wp-content\themes\theme\keid-hosting\functions.php on line 43

    I deleted the previously inserted code on line 43 but the error still remained.
    I am now completely locked out of https://localhost/wp/wp-admin/ (just shows the above error) and have tried replacing the functions.php on my c drive with the original functions.php file from my inital download but to no avail.
    How do i get back into admin to rectify this file on WP. Or is that my issue?? Site not live yet.

    Thanks in advance
    Tom

Viewing 15 replies - 1 through 15 (of 18 total)
  • Just checking, you are developing your website using localhost on your own computer ?
    You need to find the correct “functions.php” file of your active theme, preferably this will be a child theme. Fix your syntax error(s) in this file, either by restoring from an original, restoring from a backup, OR fixing what you have using this online tool:
    https://www.piliapp.com/php-syntax-check/
    Another approach, if you need to remove your theme from the site temporarily (which will also take your functions.php from the action), then just rename your theme directory in your “wp-content/themes” directory.

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Ross,
    yes on localhost on my own laptop.

    Replaced the functions file with original which didnt work and then all theme files with originals, still not working………
    Thanks for the help

    Thread Starter tmcdonald100

    (@tmcdonald100)

    How do i remove the the theme from the site temporarily, exactly, Ross?

    Using your file browser you navigate to:
    `wp-content/themes’
    Your theme is in one of these directories here. Rename this directory and WordPress will change to using the default theme.
    If this does not work then I suspect that you have not found the real files your web server is using.

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Yeah thats what i thought you meant. I tried that last night and it didnt work. Where else could they be then?
    On the error: “Parse error: syntax error, unexpected ‘<‘ in C:\xampp 1\htdocs\wp\wp-content\themes\theme\keid-hosting\functions.php on line 43” i am following the path exactly. Tried replacing the files there AND changing the name of the files as you also suggrsted to no avail. Does it have anything to do with XAMPP?
    Thanks for your patience.

    Dion

    (@diondesigns)

    If you are using an opcode cache on your localhost setup (perhaps Zend OPcache or APC), either disable it or set its revalidation frequency to zero.

    Also, the path is strange: wp-content\themes\theme\keid-hosting\functions.php

    That is not a normal path to a theme’s functions.php file. Have you changed any of the WordPress constants? If not, then what are the contents of the wp-content\themes\theme directory?

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Dion,

    No have not changed any constants. Dont know how to tbh.
    The contents of the theme directory are the other theme folders;
    Kied hosting
    Kied apps
    Kied hotel
    Kied medical
    Kied Resturant
    and
    another Kied folder.

    I was advised by the Kied support team to replace all of these folders with the originals, which i did. No change.

    It sure looks to me like your files used by the web hosting are NOT the files you are looking at.
    Please create a file called “hello.html”, with these contents:

    ‘<html>
    <body>
    Hello world
    </body>
    </html>’

    And place it into your “wp-content/themes” directory.
    Now your browser MUST display it when you browse to:
    `https://<mysite>/wp-content/themes/hello.html
    If this does not work then you have an XAMPP configuration problem,

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Yes its displaying it ok when i click on it in the themes directory.

    Excellent.
    Now rename your theme directory, this will let you login to your website.

    Thread Starter tmcdonald100

    (@tmcdonald100)

    No.
    Still getting the parse error. AAAARGH!
    I changed it exactly as you suggested.

    Then rename your directory called “themes”, this will have to disable your theme.

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Yeah i tried that earlier and again there now to make sure.
    still the same.

    Just not making sense.
    Take a backup of your files and database. Delete all the files, do you still get the syntax error, I know that this sounds dumb since you have deleted them, but please, just humor me. Now delete your database, test again. Now reinstall.

    Thread Starter tmcdonald100

    (@tmcdonald100)

    Thats a good idea. Will try it later.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Locked out of WP admin localhost due to Parse error’ is closed to new replies.