How to Add Custom CSS in WordPress (Theme Customizer & Child Theme)
Sometimes you want to adjust the look of your WordPress site without installing a plugin or editing core theme files. The safest way to do this is by adding custom CSS. In this guide, you’ll learn two recommended methods: using the WordPress Theme Customizer and creating a child theme.
Method 1: Add Custom CSS via the Theme Customizer
The easiest way to add CSS to your WordPress site is through the built-in Theme Customizer. This method is ideal for beginners because it does not require file editing or FTP access.
Step 1: Open the Theme Customizer
From your WordPress dashboard, go to Appearance » Customize.
Step 2: Navigate to Additional CSS
In the Customizer sidebar, look for Additional CSS. Click it to open the editor.
Step 3: Add Your Custom CSS
Enter your CSS rules in the editor box. For example:
/* Change the background color of the site header */
.site-header {
background-color: #0073aa;
}
/* Style links with a custom hover effect */
a:hover {
color: #e85d04;
}
You’ll see a live preview of the changes before publishing. Once you’re happy, click Publish.
Method 2: Add Custom CSS Using a Child Theme
If you plan to make extensive customizations, creating a child theme is the best approach. This ensures your changes won’t be lost when the parent theme is updated.
Step 1: Create a Child Theme Folder
Inside your wp-content/themes directory, create a new folder for your child theme. Example:
/wp-content/themes/my-child-theme/
Step 2: Add a style.css File
Inside the child theme folder, create a file called style.css and include the following header:
/*
Theme Name: My Child Theme
Template: parent-theme-folder
*/
Replace parent-theme-folder with the actual directory name of your parent theme.
Step 3: Add Your Custom CSS
Below the header, you can write your custom CSS:
/* Example: Change the font size of post titles */
.entry-title {
font-size: 28px;
font-weight: bold;
}
Step 4: Activate the Child Theme
Go to Appearance » Themes in your WordPress dashboard and activate your new child theme. WordPress will now load your custom CSS from the child theme’s style.css.
Which Method Should You Use?
- Theme Customizer: Best for quick changes and beginners.
- Child Theme: Best for long-term projects and extensive customizations.
Conclusion
Adding custom CSS in WordPress is simple and safe when done correctly. Use the Theme Customizer for quick fixes, or create a child theme for more permanent and scalable customizations. Both methods keep your changes safe from theme updates, ensuring your design stays consistent.
🎨 Want to learn more? Visit our WordPress Customization Hub for tips and advanced techniques.