• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Safely Edit Plugin And Theme Files In WordPress

By Bhagwad Park on May 9, 2022 0

How To Safely Edit Plugin And Theme Files In WordPress

If you run a WordPress site, you’ve already come across articles and tutorials telling you to make changes to either a theme or a plugin file. Apart from that, you might need to make changes to your own CSS without relying upon the inbuilt methods of your theme via the customizer. WordPress has allowed us to make these changes from the admin dashboard for years, and it’s always been dangerous. Here’s where you can edit plugin files, for example:

Making Changes to WordPress Plugins and Themes from the Dashboard
Making Changes to WordPress Plugins and Themes from the Dashboard

You can edit both theme and plugin files this way.

The Dangers of the In-Built File Editor

The problem with editing files this way is that if something goes wrong, your site can crash – including the admin section. The last part is what’s worrying. If you were relying on the admin section working to edit files, then when your admin area is inaccessible, you can’t revert the changes to fix your site!

For this reason, you must never edit files or themes from within WordPress even though you can.

When you log into your admin screen the first time, WordPress now even includes a warning advising you against making changes from this area. You can dismiss the warnings, but always remember that it’s a risk.

WordPress has come a long way in making the file editor stable. In the past, if you made a change to your plugin file that broke your site, you would be met with the dreaded “White Screen of Death”, and then unless you could find a way to revert the changes without logging into WordPress, there was nothing you could do.

These days, WordPress tries to revert dangerous changes automatically. Now if you do something that breaks your site, WordPress informs you that your changes were not saved and your site can continue working. But even then, this doesn’t catch all mistakes. It’s entirely possible for you to screw up something so bad that it slips past WordPress checks and you lose access to your admin screen.

Knowing all this, the best safest way to edit your plugin and theme files in WordPress is to use a file manager.

Using the Dedicated cPanel File Manager

Luckily, there exists a way to edit these files, that doesn’t depend on logging into WordPress. All NameHero customers have access to the cPanel backend. Here’s the file manager section:

File Manager in cPanel
File Manager in cPanel

Using this, you can navigate to your site’s folder (usually after clicking through public_html), locate the file you want, and open it in a text editor like this:

Editing Files from within cPanel and Notepad++

While you can make the changes here, I suggest you always take a backup of the file first. I do this by copy/pasting the contents into a good editor like Notepad++. I like Notepad++ because it’s built for quickly editing code, comes with inbuilt line numbers, and even syntax highlights. You can align code indentations, and easily find and replace stuff. It’s an invaluable tool for me!

So before making any changes in the cPanel editor, I suggest you copy/paste the contents into Notepad++ first. Then make and save your changes. If your site breaks, no worries. Just revert the changes in the backend, and if even that doesn’t work, take the copy in Notepad++ and replace everything in the file so that it’s back to its original state.

Use this Technique Even for Small Changes

It’s been years since I used the WordPress editor for anything. I’m too cautious to make even small changes where I’m confident nothing will go wrong. It’s a good habit to cultivate because while it can seem tempting to quickly open the WordPress dashboard and make a small change, you could end up completely breaking your site!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • The Best WordPress Plugin To Combat Plagiarism
  • Is It Time to Bring Back Blog Comments?
  • Two Filters That No Longer Work In Gutenberg (And Workarounds)
  • Migrating To The New Cloudflare Managed Rules Interface
  • How To Sort Posts By The “Last Modified” Date
  • How To Make WordPress Send E-mail From Another Address
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2023 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in