add keywords in wordpress

Ever wondered how to make your website shine on search engines without piling on a bunch of plugins? Well, you’re in the right place!

We’re diving deep into how to add keywords in WordPress without plugins. This might sound a bit techy, but it’s all about taking control of your site’s SEO.

WordPress doesn’t come with a built-in way to handle these. Most people use big SEO plugins like Yoast SEO or Rank Math SEO for this. But what if you want to keep things super lean and custom?

This guide walks through both manual and dynamic methods, ensuring every page packs relevant keywords without relying on plugins.

Understanding Meta Keywords and Their Role in SEO

So, what exactly are meta tags? They’re HTML tags that give information about your webpage to search engines and web browsers.

You’ll find them tucked away in the <head> section of your HTML document, invisible to visitors but super useful for automated systems. Although meta keywords hold less weight than years ago, they still contribute to semantic relevance when implemented correctly.

By manually inserting a <meta name=”keywords”> tag, site owners can:

  • Reinforce page topics for niche search queries
  • Offer additional context to crawlers alongside titles and descriptions

This approach bypasses plugin overhead, keeping WordPress installations faster and more secure.

Google’s Stance on Meta Keywords

Back in the early days of search engines, meta keywords were a big deal for helping pages get found. But things have changed a lot in the world of SEO!

For big search engines like Google, meta keywords don’t really affect your search rankings much anymore. Google’s smart algorithms now look at your actual content, how relevant it is, and how users interact with your page to figure out what it’s about and how valuable it is.

It’s important to remember that while other meta tags (like meta descriptions) are still super important for SEO and user experience, meta keywords specifically aren’t as powerful.

Why Not Use Plugins for Keywords

While SEO plugins offer convenience, manually adding keywords in WordPress without plugins delivers clear advantages:

1. Performance Overhead

Every plugin introduces additional PHP calls and asset loading. Even lightweight SEO plugins can slow down page rendering, negatively impacting site speed and Core Web Vitals—critical ranking factors.

2. Security & Maintenance

Plugins must be updated continuously. Outdated or poorly maintained SEO plugins can expose vulnerabilities, leaving a site open to attacks. A simple code snippet in functions.php avoids this risk.

3. Unnecessary Bloat

Comprehensive SEO suites bundle dozens of features, schema markup, redirect managers, and XML sitemaps, which many sites never use. A focused manual approach keeps WordPress lean and free of extra code.

4. Greater Control & Flexibility

By writing your own <meta name=”keywords”> implementation, it’s easy to customize logic (e.g., pulling tags, categories, or custom taxonomies) without being constrained by a plugin’s settings UI.

How to Add Keywords In WordPress Without Plugins

Method 1. Sitewide Meta Keywords Using header.php

This method is pretty straightforward: you’ll directly add the meta keywords tag into your theme’s header.php file. This approach is perfect for small or one-page websites targeting a few keywords.

Just remember, whatever keywords you put here will show up on the whole content of your website.

From your WordPress dashboard, head over to Appearance -> Theme File Editor. Once you’re in the editor, find and click on the header.php file. It’s usually on the right sidebar. Find the <head> section.

To add only meta keywords, use:

<meta name="keywords" content="site keyword1, site keyword2, site keyword3">
add keywords to wordpress without plugins using header.php

For the Code Snippet plugin, use:

add_action('wp_head', 'custom_meta_keywords_only', 1);

function custom_meta_keywords_only() {
    if (is_admin() || is_feed()) {
        return;
    }

    echo '<meta name="keywords" content="site keyword1, site keyword2, site keyword3">' . "\n";
}
using code snippet to add keywords to wordpress

To also add meta description with keywords for the site, use:

add meta description by code via header.php
<meta name="keywords" content="sitekeyword1, sitekeyword2, sitekeyword3">
<meta name="description" content="This is a concise description of my website's main focus and content." />

For Code Snippet plugin, use:

add_action('wp_head', 'custom_meta_keywords_only', 1);

function custom_meta_keywords_only() {
    if (is_admin() || is_feed()) {
        return;
    }

    echo '<meta name="keywords" content="site keyword1, site keyword2, site keyword3">' . "\n";
 echo '<meta name="description" content="This is a concise description of my website's main focus and content.">' . "\n";
}

Remember to replace the description and keywords. Don’t do only copy-paste.

Adding meta keywords and description directly below the <head> line helps crawlers find it early during parsing.

Method 2. Dynamically Generating Keywords via header.php

This method is for users who want to have separate keywords for each post.

Similar to method 1. Go to Appearance -> Theme File Editor. Access the header.php file located on the right sidebar. Locate the <head> section.

Just before the <?php wp_head(); ?>, paste the following code:

<?php
  if (is_singular()) {
      $tags = get_the_tags();
      if ($tags) {
          $keywords = array_map(function($tag) {
              return esc_attr($tag->name);
          }, $tags);
          echo '<meta name="keywords" content="' . implode(', ', $keywords) . '">' . "\n";
      }
  }
  ?>
add meta description by code to wordpress dynamically

This code fetches tags entered in the post editor and saves them as meta keywords.

adding meta tags in wordpress post editor

If you want to add meta description also, use:

	 <?php
  if (is_singular()) {
      $tags = get_the_tags();
      if ($tags) {
          $keywords = array_map(function($tag) {
              return esc_attr($tag->name);
          }, $tags);
          echo '<meta name="keywords" content="' . implode(', ', $keywords) . '">' . "\n";
      }
	   $excerpt = get_the_excerpt($post->ID);
        if (!empty($excerpt)) {
            $description = esc_attr(strip_tags($excerpt));
            echo '<meta name="description" content="' . $description . '">' . "\n";
        }
    }
  ?>

This code will fetch the excerpt you wrote and show it as your meta description to search engines.

excerpt as meta description in wordpress

Here’s a quick look at the best method to use:

showing comparison of methods to add keywords in wordpress without plugins

Verify Your Manual Meta Keyword Implementation

Open the post for which you have provided keywords. Right-click anywhere on the post and select “View page source,” or simply press CTRL+U on your keyboard, or Option + Command + U for Mac users.

You will see the <meta name=”keywords” in the first lines, or search for it by pressing CTRL + F on the keyboard. The meta description will be just below the meta keywords. They should appear below the <head> and before the <head/> line.

viewing the added keywords in wordpress without plugins

After implementing manual meta tags, it is crucial to validate their correctness. Some free online tools give you ways to validate the correctness of the HTML code of your pages or even check the meta keywords and description used in posts.

You can check the HTML markup on W3C Markup Validator. OR, use the Meta tag analyzer to check the meta information of your post.

Frequently Asked Questions

Conclusion

Adding keywords to your WordPress site is one of the most important steps for improving your visibility on search engines. Whether you’re using custom code, tags, or excerpts, optimizing your content with the right keywords can significantly boost your SEO performance.

Just remember, it’s not about stuffing keywords, but about placing them strategically to help both users and search engines understand your content.

If you have any questions or need help with keyword placement, feel free to drop a comment below. We’re here to help.

If you found this guide helpful, don’t forget to share it!

Don’t Miss These Posts!

Leave a Reply

Your email address will not be published. Required fields are marked *

two × 1 =