How to Add Custom CSS to Your WordPress Site

CSS is the backbone of web design, the tool that transforms a website from a collection of words and images into a visually engaging experience. In the WordPress ecosystem, the power of custom CSS can be harnessed directly within posts or pages, thanks to the versatile Custom HTML block.

Whether you’re looking to make minor stylistic adjustments or start on a complete visual overhaul, this feature allows you to tailor your site’s aesthetics to your exact specifications. By adding your own CSS code, you can control everything from fonts and colors to layout and spacing, ensuring your WordPress site reflects your unique vision and pleases your audience.

Step-by-Step Guide to Adding Custom CSS to a Post or Page

Step 1: Navigate to Your Post or Page Editor

Start by logging into your WordPress dashboard. Select the post or page where you wish to add custom CSS. If it’s a new post or page, click on “Add New” under the Posts or Pages menu. For existing content, simply find the post or page you want to edit and open the editor.

Step 2: Add a Custom HTML Block

With the Gutenberg editor (the default editor for WordPress), adding custom code is straightforward. Click on the “+” icon to add a new block, and search for “Custom HTML.” Click on it to add the block to your post or page.

Step 3: Insert Your CSS Code

Inside the Custom HTML block, you will write or paste your CSS code. To ensure that your code executes properly, it needs to be wrapped in <script> tags. Here’s a simple example:

  // Your CSS code here
  a {
    color: green;
    text-decoration: none;

This example colors your links green. You can replace the content within the <style> tags with your custom CSS code.

Step 4: Preview and Publish

After inserting your CSS code, it’s wise to preview your post or page to ensure the script operates as expected. If everything looks good and your script functions correctly, go ahead and publish or update your post or page. Your custom CSS is now live and part of your WordPress site.

Step-by-Step Guide to Adding Site-Wide CSS Using WPCode

Step 1: Install and Activate WPCode

First, log in to your WordPress dashboard and navigate to the Plugins section. Click on “Add New” and search for “WPCode – Insert Headers and Footers Scripts.” Once you find the plugin, install it by clicking “Install Now,” and then activate it.

Step 2: Open WPCode’s Custom Code Manager

After activating the plugin, you’ll find a new menu item in your dashboard named “Code Snippets.” Click on it to access the WPCode’s custom code manager. This central location allows you to manage all your custom code snippets, including JavaScript, CSS, and HTML.

Step 3: Create a New Code Snippet for Your CSS

Click on the “Add Snippet” button to create a new code snippet.

WPCode provides various templates, but for adding CSS, you can choose the “Custom Code” template.

Give your snippet a descriptive name, like “My Custom CSS,” to easily identify its purpose later.

Then select CSS Snippet under “Code Type”.

Step 4: Add Your CSS Code

In the code editor provided by WPCode, you will insert your CSS code. Since this script will be applied site-wide, ensure it’s designed to not interfere with other scripts or page-specific functionalities. A script might look something like this:

// Your CSS code here
a {
  color: green;
  text-decoration: none;

Step 5: Set Where to Insert Your Code

WPCode allows you to specify where your CSS should be loaded. Select either the “Header” or “Footer” option in WPCode.

Step 6: Activate and Test Your Snippet

After adding your CSS, activate the snippet by toggling the status to “Active.” Then, visit your site to ensure the CSS behaves as expected.

Important Considerations


Integrating custom CSS into your WordPress posts or pages allows you to create more aesthetic content. By following the steps outlined above, you can significantly enhance your site’s look and user experience. Whether you’re aiming to add a touch of color or change a font, the Custom HTML block and plugins like WPCode are your gateway to a more interactive and engaging website.

Related Posts