Receiving PHP errors is not common in WordPress, it is an error that occurs when a file has not been properly coded and in most cases this error prevents you from using your WordPress blog. Experienced developers often have no trouble fixing this error on their own server, but if you're new to WordPress, it won't be easy for you.

You might be stuck on how to implement a remediation method when you can't even open the dashboard. We are going in this tutorial to explain the code analysis error that you will encounter on your and how to fix them.

Let's start.

What you need to know about errors and WordPress

By default, WordPress does not display any PHP errors, the reason is simple, because displaying PHP errors will show hackers the different vulnerabilities that exist on your website. In return, as a web developer, you can enable error reporting on WordPress using the PHP constant WP_DEBUG_LOG which is set to " true » in the wp-config.php file. In this case, the errors will no longer be displayed on the site, but saved in a file in your accommodation.

In addition, if you still want to display PHP errors on your site directly, you can use the constant " WP_DEBUG Which you can also set to "true". The WordPress codex offers more useful information on this subject.

How to fix a parse error: Parse Error

This is a syntax parsing error that prevents PHP from understanding the code.

parse-error-error-php-wordpress

As a result of this error quote, you will often notice other information that will help us better identify the source of the problem.

The nature of the problem

In the case of this error, PHP provided more information by saying " Unexpected $ end Which means that the PHP file ends when a brace has not been correctly delimited (Or a function).

Nature-the-problem-php

The file concerned

In this case, PHP lets you know which file is affected by this error. In our case, PHP tells us the file " wp-content / themes / zerif-lite / functions.php ».

File-respect-by-the error-php

Line concerned

In addition to providing you with the affected file, PHP also gives you the line of code that is affected by the error. In our case, PHP reports "on line 91". All you have to do now is recover the affected file and fix the error.

I invite you to do this if you are the author of the theme or are a developer. If you detect this error on a theme you just bought then this theme has not been correctly coded, and therefore I invite you to delete the theme folder and contact the developer with this different information.

We will still show you how to correct the above error.

Sign in to your hosting with an FTP client

Now we are going to search for the affected file in the “zerif-lite” theme folder.

exploration of folder-ftp

Once you access the folder zerif-lite », Download his file« functions.php That you save somewhere on your computer.

What tool to correct the error

The ideal would be to use a text editor that supports PHP. I propose you a list of simple tools to download that will allow you to correct the error.

Choose the one that will inspire you the most. Anyway all these text editors can be used to correct this problem.

error-function-php-zerif-lite

These programs number each line of your file, as in the following image, which will allow you to easily find the line concerned by the error.

The correction of this error will therefore depend on your level of experience. But what you need to know is that any element that opens must necessarily close in principle. When we use an opening parenthesis, it is because at the other end we have a closing parenthesis, this is the case with the square brackets " [ , The apostrophes, the braces « { ».

Since we are dealing with an error " Unexpected end Then certainly a hug was not closed. You can explore the code or use a code editor that monitors these errors " of beginners ».

Once you have successfully fixed the error, then you can send the file to your accommodation. If all goes well, your site should be available again.

the error-correcting-on-wordpress

If the error is about an internal WordPress file (read the path of the file concerned), so you can always download a new version of WordPress and overwrite the one you have installed.

That's all for this tutorial, I hope you will come to correct the errors on WordPress. If you have different mistakes, I'll be happy to explain how to fix them.