If you want to know how to add meta keywords in WordPress without a plugin, the short answer is a few lines of PHP hooked into wp_head, either in your child theme’s functions.php or, less ideally, directly in header.php. It takes about five minutes, and it works on any self-hosted WordPress install. Before you do it, though, it’s worth knowing that Google has ignored the keywords meta tag since 2009, so I’ll show you the code and then the honest cost-benefit.
Quick answer: the three no-plugin methods
- Site-wide keywords via functions.php: one function, one
add_action, same keywords on every page. Fastest to set up, least useful for SEO. - Per-post keywords via a custom field: a custom post meta value (for example
meta_keywords) printed only on singular posts and pages. This is the method I’d recommend. - Direct edit in header.php: paste a static meta tag before the closing
</head>. Works, but theme updates can wipe it.
Before you touch a single file
Editing theme files is the fastest way to white-screen a live site, so set up a safety net first. A syntax error as small as a missing semicolon in functions.php will take the whole front end down until you fix or revert the file.
- Take a backup you can restore in one click, or at least download a copy of the file you’re about to change.
- Use a child theme so a parent theme update doesn’t overwrite your work. If you’re on a block theme, functions.php still exists and still works.
- Prefer SFTP or a file manager over the built-in Appearance > Theme File Editor, because you’ll want a way back in if the site breaks.
- Test on staging if you have it. Most decent WordPress hosting plans include a staging environment at no extra cost.
This whole approach assumes a self-hosted WordPress install where you control the theme files. On WordPress.com’s lower tiers you can’t edit PHP at all, which is one of the practical differences people run into.
Method 1: add meta keywords site-wide in functions.php
This is the shortest route. Open your child theme’s functions.php, scroll to the bottom, and add:
function nick_site_meta_keywords() {
echo '<meta name="keywords" content="wordpress hosting, managed hosting, litespeed cache" />' . "\n";
}
add_action( 'wp_head', 'nick_site_meta_keywords', 2 );
The wp_head hook fires inside the document head on every page that a properly coded theme renders, so you don’t need to touch template files. Save, reload your homepage, then view source and search for “keywords” to confirm the tag is there.
The catch is obvious: every URL on the site now advertises the same keyword list, which tells a crawler nothing useful about an individual page.
Method 2: per-post meta keywords with a custom field
This is the version worth building. You store keywords per post in WordPress custom post meta, then print them only when a single post or page is being viewed.
Step one, add this to functions.php:
function nick_post_meta_keywords() {
if ( ! is_singular() ) {
return;
}
$keywords = get_post_meta( get_the_ID(), 'meta_keywords', true );
if ( empty( $keywords ) ) {
return;
}
echo '<meta name="keywords" content="' . esc_attr( $keywords ) . '" />' . "\n";
}
add_action( 'wp_head', 'nick_post_meta_keywords', 2 );
esc_attr() matters here. Without it, a stray quote in your keyword string can break the tag or open an injection hole, and that’s exactly the kind of small mistake that turns a five-minute tweak into a support ticket.
Step two, turn the custom fields panel back on. In the block editor, open the three-dot Options menu, choose Preferences, then Panels, and enable Custom fields. The page reloads with a Custom Fields box below the content.
For a closer look at this topic, see our guide: How to Add Schema Markup to WordPress Without a Plugin (2026 Guide).
Step three, click Add New Custom Field, name it meta_keywords, and put your comma-separated terms in the value box (four to eight terms is plenty). Update the post, view source, and you should see the tag rendered in the head.
Optional: generate keywords from post tags
If you already use tags consistently, you can skip the manual entry entirely:
function nick_tags_as_keywords() {
if ( ! is_single() ) {
return;
}
$tags = get_the_tags();
if ( ! $tags ) {
return;
}
$names = wp_list_pluck( $tags, 'name' );
echo '<meta name="keywords" content="' . esc_attr( implode( ', ', $names ) ) . '" />' . "\n";
}
add_action( 'wp_head', 'nick_tags_as_keywords', 2 );
Method 3: editing header.php directly
You can also open header.php and drop a static tag just above <?php wp_head(); ?>. It’s the method most tutorials lead with, and it’s the one I’d avoid on a site you plan to keep. Parent theme updates replace the file, block themes may not have a usable header.php, and the tag can’t vary by page without extra conditional logic.
While you’re in there: meta title and description without a plugin
Most people searching for keyword tags actually want better snippets, and the meta description is the tag that still influences click-through. Here’s a simple fallback that uses the excerpt when one exists:
function nick_meta_description() {
if ( ! is_singular() ) {
return;
}
$text = has_excerpt() ? get_the_excerpt() : wp_trim_words( get_post_field( 'post_content', get_the_ID() ), 30 );
echo '<meta name="description" content="' . esc_attr( wp_strip_all_tags( $text ) ) . '" />' . "\n";
}
add_action( 'wp_head', 'nick_meta_description', 1 );
Keep descriptions around 140 to 155 characters so they don’t get truncated in results. For the title tag, filter document_title_parts rather than hard-coding anything, and make sure your theme declares add_theme_support( 'title-tag' ).
Do meta keywords still do anything in 2026?
Google confirmed back in 2009 that it does not use the keywords meta tag in web ranking, and that hasn’t changed since. Bing has said publicly it may treat the tag as a spam signal when it’s stuffed. Yandex and a few smaller engines still read it, which is the honest reason some site owners bother.
So the Reddit-style consensus is roughly correct: adding keywords is harmless if you keep it short and accurate, and pointless if you expect rankings from it. If you want the tag for internal search, an intranet, or a regional engine, use the per-post method above and keep lists under about eight terms.
The tags that actually earn attention now are the ones Google documents in its special tags reference: description, robots, canonical, and Open Graph data for social previews. Spend the saved effort there, or on the things that move rankings for real, like page speed and internal linking. Our guide on getting a WordPress site into Google Search covers that order of operations.
Verify the tag is actually rendering
- View source (Ctrl+U) on a published post and search for
name="keywords". Don’t rely on DevTools’ Elements panel, which shows the modified DOM. - Purge your cache. Full-page caching means an old HTML copy can be served for hours. On LiteSpeed setups a single purge-all does it.
- Check for duplicates. If an SEO plugin is still active, you may now be outputting two keywords tags, which looks sloppy to crawlers.
- Watch the numbers for a few weeks in your hosting analytics and Search Console rather than judging by feel.
One thing worth flagging if you’re on managed hosting: PHP snippets in a child theme are fine everywhere, but plugin restrictions vary by host. We wrote about plugin compatibility on managed WordPress hosting if you’re weighing code versus a plugin long term.
Frequently Asked Questions
Are meta keywords outdated for SEO?
Yes, for Google they’ve been irrelevant since September 2009, when Google publicly confirmed the keywords meta tag plays no part in web ranking. Bing may read it as a spam indicator if it’s stuffed, while Yandex still parses it. Adding a short, accurate list won’t hurt you, but it won’t lift rankings either.
How do I put meta tags on my website?
Any meta tag goes inside the <head> element, and in WordPress the clean way is a function hooked to wp_head in your child theme’s functions.php. That single hook covers every template, so you avoid editing header.php. Always run values through esc_attr() before printing them.
Can I add meta keywords in WordPress for free without any plugin?
Yes, all three methods here cost nothing beyond about five minutes and file access. You need a self-hosted install with theme file editing enabled, which rules out the free WordPress.com tier.
Will editing functions.php slow my site down?
No, a snippet that prints one meta tag adds well under a millisecond to page generation. Performance problems come from unoptimized queries, bloated plugins and missing caching, not from a few lines in wp_head.
What happens to my code if I switch themes?
Anything in a theme’s functions.php or header.php stops running the moment you activate a different theme. Keep a copy of your snippets in a text file, or move them into a small site-specific mu-plugin so they survive theme changes.
Want WordPress that’s fast before you tweak a single tag?
Meta tags are a five-minute job; hosting is what decides whether your pages load in 0.8 seconds or four. Compare our WordPress plans or talk to a specialist about migrating your site free of charge.
[…] meta keywords are dead, and you do not need a plugin to control basic head tags. Our guide on adding meta keywords in WordPress without a plugin covers the manual route if you prefer fewer […]