How to Edit WordPress Themes
A safe, step-by-step guide to editing WordPress theme code without breaking your site
Want to tweak your WordPress theme but worried you’ll “white screen” your site? Whether you’re using a classic theme like Jannah with the Classic Editor or another PHP-based theme, editing theme files directly can be powerful—and dangerous—if you don’t follow a safe workflow.
In this guide, you’ll learn how to edit WordPress themes the right way: using child themes, the Theme File Editor, FTP/File Manager, and custom CSS. We’ll focus on classic themes (not full-site-editing block themes) and show you how to protect your live site while you change templates, CSS, and functions.
If you’re still in the process of picking a design, start by learning how to choose a WordPress theme, then come back here once you’re ready to edit the underlying code.
Prerequisites
Before you touch any theme file, make sure a few basics are in place. Skipping these steps is the fastest way to break your site or lose work.
- Administrator access to your WordPress dashboard.
- Hosting access: cPanel/File Manager or SFTP/FTP credentials.
- Recent full backup of your site (database + files).
- Optional but strongly recommended: a staging copy of your site (you can create a WordPress staging site first).
- A code editor (VS Code, Sublime Text, or similar) if you’re editing files via FTP/File Manager.
Step 1: Understand your Edit WordPress theme structure
To edit wordpress theme safely, you need a basic mental map of how to edit WordPress theme files are organized. All themes live under /wp-content/themes/. Each folder there is a separate theme (for example, jannah and jannah-child).
Inside a typical classic theme you’ll see files like:
- style.css – main stylesheet that controls the overall look.
- functions.php – theme functions, hooks, and custom PHP.
- header.php, footer.php, sidebar.php – layout for header, footer, and sidebar.
- index.php, single.php, page.php, archive.php – templates that control different types of pages.
- template-parts/ – reusable chunks of layout (post loops, hero sections, etc.).
WordPress picks which file to use based on its template hierarchy. When you edit one of these files, you’re changing how the site is rendered—not just content like posts or pages.
Step 2: Create and activate a child theme
Edit WordPress theme directly is a common beginner mistake. When the theme updates, your edits are overwritten. A child theme lets you safely override templates and styles without touching the original code.
- In your hosting panel (File Manager) or via FTP, go to
/wp-content/themes/. - Create a new folder, for example
jannah-child. - Inside that folder, create a file called
style.csswith at least:/* Theme Name: Jannah Child Template: jannah */ - Create a
functions.phpfile in the child theme folder and enqueue the parent stylesheet:function jannah_child_enqueue_styles() { wp_enqueue_style( 'jannah-parent', get_template_directory_uri() . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'jannah_child_enqueue_styles' ); - In the WordPress dashboard, go to Appearance → Themes and activate your new child theme.
For a more detailed walkthrough with screenshots and extra options, follow our dedicated guide on how to create a child theme in WordPress.
Step 3: Edit WordPress theme code safely in the WordPress dashboard
WordPress includes a built-in Theme File Editor that you’ll find under Appearance → Theme File Editor (previously “Editor”). It’s handy for small tweaks, but because it edits live files, you must be extremely careful.
- In the dashboard, go to Appearance → Theme File Editor.
- Use the drop-down in the top-right to ensure your child theme is selected (for example, “Jannah Child”).
- In the file list on the right, click the file you want to change (such as style.css or a specific template like single.php).
- Make a small, incremental change. For example, adjust a font size or add a CSS rule.
- Click Update File and immediately open your site in a new tab to verify everything still loads.
Step 4: Edit WordPress themes files with FTP or File Manager
For anything more than tiny, low-risk tweaks, edit theme files outside the dashboard. Working over FTP or cPanel’s File Manager, combined with a proper code editor, makes it easier to back up files and fix mistakes.
- Connect to your site: Open your FTP client (FileZilla, Cyberduck, etc.) or cPanel’s File Manager.
- Locate your theme: Navigate to
/public_html/wp-content/themes/jannah-child/(or the child theme folder you created). - Back up the file: Download the file you plan to edit (for example,
single.phporheader.php) to your computer first. - Edit locally: Open the file in your code editor, make your changes, and save.
- Upload and test: Upload the modified file back to the same location and refresh your website. If something looks wrong, overwrite it with the backup copy you downloaded.
Editing via FTP/File Manager also lets you work even if you’re locked out of wp-admin after a bad change, because you can revert the file directly on the server.
Step 5: Add custom CSS without breaking your layout
Most visual tweaks—colors, fonts, spacing—can be done with CSS alone. Here are the safest ways to add custom CSS to a WordPress theme.
Option 1: Additional CSS in the Customizer
- Go to Appearance → Customize → Additional CSS.
- Paste your CSS rules into the editor and watch the live preview update.
- Click Publish when you’re happy with the changes.
This is ideal for small snippets. The CSS is stored in the database, so it isn’t lost when you update the theme.
Option 2: Theme or Jannah options panel
Many premium themes, including Jannah, offer a Custom CSS box in their options panel. This works similarly to Additional CSS but keeps all theme-specific tweaks in one place.
Option 3: Child theme style.css
For larger CSS sets or when you want full control in version control, place your CSS in the child theme’s style.css file.
/* Example: make post titles larger */
.single .post-title {
font-size: 2.4rem;
line-height: 1.2;
}
Step 6: Test, debug, and roll back theme edits
Once your edits are in place, it’s time to test thoroughly. You want to avoid surprises on mobile devices, in different browsers, or for logged-out visitors.
- Check the pages that use the template you edited (single posts, pages, archives, homepage, etc.).
- Test on desktop, tablet, and mobile screen sizes. Look for layout issues, overlapping elements, and unreadable text.
- If you use caching (plugin or hosting), clear all caches and then reload.
- Ask someone else to test the site while logged out to make sure everything works as expected.
If something isn’t working, enable WordPress debugging temporarily to catch PHP errors. In wp-config.php (accessed via FTP/File Manager), above the line that says /* That's all, stop editing! */, add:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This will write errors to wp-content/debug.log without showing them to visitors. Remember to switch WP_DEBUG back to false after you finish troubleshooting.
Edit WordPress themes with confidence and control
Edit WordPress theme doesn’t have to be scary. With a child theme, a safe editing method (Theme File Editor for small tweaks, FTP/File Manager for bigger changes), and a solid testing routine, you can shape your site’s look and behavior without constantly fearing a crash.
Start with the basics: set up backups and a staging site, build your child theme, and then work in small, controlled steps. Over time you’ll develop a repeatable workflow for theme edits that keeps your design flexible and your site stable.
Further Reading
- How to Edit WordPress Files
- How to Customize a WordPress Theme
- WordPress Backup Strategy for Safer Changes
- How to Install and Activate a WordPress Theme




