Dark mode for WordPress
WordPress has no settings box for adding code to every page, so you add the line with a small free plugin. These steps use WPCode from the WordPress.org directory.
Add DarkYes to your WordPress site
- 1
Create a free DarkYes account and add your site's address. In your dashboard, press Get the code next to the site, then Copy code.
Your line looks like this, with your own key in place of
YOUR-KEY:<script src="https://darkyes.com/d.js" data-key="YOUR-KEY" async></script> - 2
In your WordPress admin, go to Plugins, then Add New Plugin.
- 3
Search for WPCode, then install and activate “WPCode – Insert Headers and Footers + Custom Code Snippets”.
- 4
In the admin menu, go to Code Snippets, then Header & Footer.
- 5
Paste your line into the Header section and press Save Changes.
- 6
If your site uses a caching plugin, clear its cache.
Check that it works
- 1
Open your site in a private window.
- 2
Look for the switch in the bottom-right corner, and press it.
- 3
In your dashboard, the site changes from “Waiting for the first visit” to “Active”.
Remove it
Delete the line from the Header section in WPCode and press Save Changes.
Your site then looks exactly as it did before.
These steps were checked against WPCode's guide to header and footer code on 14 November 2026.
Try it on your own site.
Create a free account, add your site and paste one line. When your first site goes live, you get 14 days of Pro for free.