1

I altered some functions in the PHP file of my website using WordPress Admin Panel:

AppearanceEditor

Now not only has my website been destroyed, but also the WordPress dashboard. I cannot access anything on there that allows me to edit the website, such as AppearanceEditor, or PagesAll Pages, NOTHING!

The error I get when I try and access the dashboard editor pages is below (I get the same error when I type the frontend URL of my website into my browser as well):

Fatal error: Cannot redeclare twentyseventeen_widget_tag_cloud_args()

Note: I cannot even access the PHP file that I altered because I'm editing using WordPress back end's AppearanceEditor.

1

Why it happened:

Since WordPress back end editor runs on top of WordPress itself, if you cause a critical Error within the PHP files, that will cause error on the backend Admin Panel as well. At that point you will no longer be able to access the backend editor until you fix the error.

What is that Error:

When you see PHP reporting an error like the following:

Fatal error: Cannot redeclare some_function_name()

This means that the above mentioned function was already declared before and then you created a function with the same name again. PHP cannot have the same function name more than once within the same scope.

In your case, you probably created a new theme function named twentyseventeen_widget_tag_cloud_args() which already existed in the functions.php file of Twenty Seventeen theme.

How to solve it:

Now you cannot access PHP from WordPress backend (the reason is explained above), but you can still access the PHP files from FTP (ask your web host) or from CPanel (or any such control panel) provided by your web hosting company.

Once you can access the PHP files by other means, you need to remove (or rename) that newly created function named twentyseventeen_widget_tag_cloud_args() and save the file.

Note: As already suggested by Mat, it's not a good practice to edit PHP files from WordPress backend editor. Instead use FTP (preferably FTPS or SFTP) or an alternate file editing method from your web server.

  • 1
    Brilliant, thanks very much for the depth of your answer! – pho_pho May 23 '18 at 15:34
0

This is exactly why you shouldn't really use the WordPress Appearance -> Editor.

Your website is not 'destroyed' though. Simply login to your web hosting control panel and use the file manager to remove whatever code you entered (the call to the twentyseventeen_widget_tag_cloud_args() function, or use an FTP client to edit your files and remove the function call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.