How to Find a Specific Line of Code in WordPress Files

In WordPress by Fathi Arfaoui0 CommentsLast Updated: September 29th, 2017

The best thing about WordPress is that you can easily edit your entire blog, change the layout, and customize your theme. But when it comes to a beginner blogger who doesn’t have the necessary knowledge about coding and hosting, the browser can display errors with some indication about the file lines.

This is what many people can’t solve, if you’re a newbie, you need to know how to find a specific line of code in WordPress to solve the problem.

The majority of the error messages with line indications that appear in browsers can be caused by theme function errors and poor server configurations. In some cases, you will get a similar error when you have wrong permissions or outdated theme files in WordPress.

The WordPress error messages with line codes are not as other issues. In that case, you get a line that has the problem, and even, you get exactly the wrong syntax and words.

Please make sure that you have a full backup of your blog, to avoid any future mistake, that you can make. Even, if you’re sure at 100% about the solutions, in some cases the problem can happen.

First, you need an editor software to be able to open the WordPress files that are in PHP. So, what you need now is to download the best and most popular PHP editor called  Notepad ++.

It works on Windows and Mac, and it’s an open source and it can display any file with lines, colors, and a great interface that even a child can understand. You will see the number of lines in your file. So, you will be able to find any link showing in the WordPress error messages.

Related Content:  Can't Access WordPress Admin After Changing URL? Here is the Fix

how to find a specific line of code in wordpress

You can also find and download other editors like TextWrangler, which is built especially for Mac. But, I strongly recommend Notepad, it’s useful for all OS and easy to understand and edit files. It’s a small zip file that doesn’t need any settings to start working.

How to find a specific line of code with Notepad?

After downloading Notepad, login to your hosting account and locate the file where you have an error. Then, download it to your local machine.

Then, right-click and click “Edit with Notepad++” and you get the file opened as below:

edit file code

As you can see, you can find the exact line of code in your WordPress file, and edit it. If you have a long file, just click on ”Ctr+F” to search the exact line in the box. Thus, you are able to change codes or to delete them if they’re not necessary.

After completing the editing, save the file, at the top right corner, and replace your old file by uploading the new updated file to your WordPress folders.

If you can’t download the file from your hosting control panel, you can edit the file directly in its location by using an FTP client like Filezilla. It’s free and easy to use when uploading or downloading files.

All you have to do is to login with your FTP details, and locate the file with problems. Next, right-click and “Edit File”, the file will be downloaded automatically to your local machine, edit it and click ”Save”. You will notice a message that validates the changes by replacing the old file with the new one.

Related Content:  How to Secure WordPress Login Page in Simple Steps

Through these two methods, you can edit any file in WordPress, and find codes to solve errors. The real step here is to read carefully the error message and find the exact code to avoid mistakes, with other files that work properly.

About Fathi Arfaoui

Fathi Arfaoui: Blogger, and the founder and owner of Trustiko.com. He shares Business, Blogging, WordPress, Web Safety, and Blogging tips to build better websites and blogs. Also, he shares online marketing strategies and recommendations.

Leave a Comment