Want to add meta keywords in WordPress without using another plugin? If you want a simple, fast, and optimized website, you can manually add meta keywords by editing theme files or using custom fields. In this tutorial, you will learn easy and code-based ways to add static or dynamic meta keywords without compromising the structure of your on-page SEO. 


Comprehensive Summary: How to Add Meta Keywords in WordPress


Topic Key Takeaway 
What Are Meta Keywords? Meta keywords are HTML snippets placed in a page’s <head> section to signal topic relevance to search engines. 
Do They Still Matter? Google largely ignores them, but they retain value for niche search engines and internal site search. 
Method 1: header.php Add static meta keywords directly to your theme’s header.php file — best for site-wide, static tags. 
Method 2: functions.php Use the wp_head hook in functions.php to inject dynamic, per-page meta keywords via PHP. 
Method 3: Custom Fields Assign unique keywords to each post or page using WordPress custom fields and retrieve them with PHP. 
Best Practice Always edit files inside a child theme and validate your output by viewing page source after implementation. 

Introduction: A Simple Fix with Big SEO Impact


Imagine this: you have just launched your WordPress site, and everything is just the way it should be – until you notice that your pages lack meta keywords in the HTML header. You go to the WordPress dashboard to find the settings field where you can enter the meta keywords… and you won’t find it. This is because WordPress doesn’t include meta keywords by default. 

Most tutorials will instruct you to install an SEO plugin. But what if you are building a lean site and want to avoid plugin bloat? The good news is that adding meta keywords in WordPress without a plugin is possible, and it takes less than 10 minutes. 

As per the WordPress Codex, the default installation of WordPress does not include meta description and keyword tags. These need to be added either through theme files or through plugins. This tutorial will help you do it through code. 


What Are Meta Keywords in WordPress?



Meta keywords are tags located at the top of a webpage that describe its content to search engines. The meta keywords tag contains the actual terms that define what the respective web page is about. Here is an example of a meta keywords tag: 

<meta name=”keywords” content=”wordpress seo, meta keywords, add meta tags” /> 

Meta tags are a feature created for search engines in the beginning stages of the web for informative purposes only; this information is in the code behind the actual web page (invisible to people) but searchable by “crawlers” from search engines. 

According to the WordPress Codex, meta tags provide information such as a description of your content, keywords, an author’s name, etc. This information, referred to as metadata, is of great importance when it comes to search engine indexing your content properly. Although the effect of the meta tags is less significant in Google search rankings, they are part of a well-structured HTML document and may have an effect on smaller search engines. 


Do Meta Keywords Still Matter for WordPress SEO?


This is an important question to ask yourself before you decide to add meta keywords in WordPress without a plugin. The honest answer: it depends on your goals.  

Google publicly confirmed that it does not use the meta keywords tag as a ranking factor. However, other search engines such as Yandex (Russia) and Baidu (China) still use the meta keywords tag when indexing a page. Moreover, some internal site search tools and content management systems use it. 

Here is a brief overview of when meta keywords are still relevant: 

  • You are targeting users of Yandex, Baidu, or other regional search engines 
  • You have implemented an internal search system that uses meta tags 
  • You are building a standards-compliant HTML document structure  
  • You are maintaining older sites that have used meta keywords 

Note that Google does not use meta keywords; however, they also won’t hurt you to implement them when they make sense within your overall SEO strategy. 


Before You Begin: Important Prerequisites 


You’ll want to do some initial set up before you learn how to add meta keywords to your WordPress site without using a plugin. 

  • Backup your website before you edit any files on your theme. 
  • Using a child theme vs a parent theme gives you the ability to modify your site without losing your changes when a theme is updated. Speaking of theme management, if you have accumulated unused themes over time, using the <mark>best WordPress plugin to clean up old themes</mark> can help you keep your installation lean and reduce potential security risks before you begin editing theme files. 
  • To find the files you need to edit, go to Appearance > Theme File Editor in your WordPress dashboard. 
  • Finding header.php and functions.php in your theme. 

Method 1: Add Meta Keywords via header.php (Static Tags)

To insert meta keywords into WordPress without using a plugin, the most straightforward method to use is through editing your theme’s header.php file. By doing this, you will have meta keywords that apply to all pages of your website. This method is typically recommended for smaller, static types of sites or for single subject blogs. 

Step-by-Step: Editing header.php 

  1. From the WordPress dashboard, head over to Appearance > Theme Editor from the left-hand menu. 
  1. Click on header.php on the right panel of the theme you’ve selected as “active”. 
  1. Locate the closing  tag in the file. 
  1. Place the following meta keyword tag directly above the </head>: 

<meta name=”keywords” content=”your primary keyword, secondary keyword, another keyword” /> 
 

  1. Click Update File to save your changes. 

You can also add a meta description and author tag in the same block: 

<meta name=”description” content=”This is a short description of your website.” /> 
<meta name=”keywords” content=”wordpress seo, meta keywords, website optimization” /> 
<meta name=”author” content=”Your Name” /> 
 

Limitation – Using method 1 will assign the exact same keywords to all pages within your website. If you want to use different meta-keywords for each post/page, then you would need to use method 2 or method 3.    

This method works best for a business that has multiple pages that consistently cover a similar subject area (e.g. portfolio site, landing site, or small business). 


Method 2: Add Meta Keywords via functions.php (Dynamic Tags) 

If you want to have dynamic meta keywords, which change based on the post or page, then modifying the functions.php file is the recommended option. This method leverages the WordPress core wp_head hook, which allows the inclusion of meta tags in the header section of the HTML document in a programmatic fashion. 

Step-by-Step: Editing functions.php 

  1. Go to Appearance > Theme File Editor
  1. Select functions.php (Theme Functions) from the right-hand panel. 
  1. Scroll to the bottom and paste the following code: 


  1. Click Update File to save your changes. 

In the code snippet, `is_single()` and `is_page()` are WordPress conditional tags for individual posts and pages, respectively. More conditions can be added, such as `is_home()` for the blog homepage or `is_category()` for category archive pages. 

Auto-generated meta keywords can also be achieved using the tags and categories of the post. Here’s the function for it: 



This function retrieves the tags and categories assigned to the post and outputs them as keywords. This is useful for blogs with many posts, as you don’t need to manually input keywords for each individual page. 


Method 3: Add Meta Keywords Using WordPress Custom Fields 

For the best flexibility in controlling how to specify various keywords by allowing each posting and individual page to specify a unique set of keywords, you would utilize WordPress Custom fields. For example, using Custom fields, you have the option of specifying different keywords for each post from within your post editor, then from your Functions.php, you can also specify ways of pulling the keywords (custom field) with PHP coding. 


Step 1: Add a Custom Field to Your Post or Page 

  • Open any post or page in the WordPress editor. 
  • If you don’t see Custom Fields on the screen, you can enable it under Screen Options located on the top right of the screen. 
  • Locate the field named Name and enter the following text into that field: meta_keywords 
  • In the Value field, enter your keywords separated by commas like this: wordpress seo, add meta keywords, meta tags guide 
  • Click on Add Custom Field and save your post/page. 

Step 2: Retrieve and Output Custom Field Keywords 

Now add the following code to your child theme’s functions.php file to output these keywords in the page’s <head> section: 

The get_post_meta() call retrieves the value that you put into that custom field, and the esc_attr() call tidies things up to keep everything nice and secure. If you operate a large or agency site and need to keep track of SEO settings for each URL, this will greatly help you. 

Keep your meta keywords between 10-15 keywords per page, with the first keyword being your most important keyword and the rest of the secondary keywords in order of importance. 


How to Verify Your Meta Keywords Are Working 


After adding meta keywords in WordPress without a plugin using any of the methods above, verify that the tags are correctly appearing in your page’s HTML. 

  • Right click on your webpage, select View Page Source, or use the keyboard shortcut Ctrl + U/Cmd + U.  
  • Press Ctrl + F, type meta name=”keywords”, and press Enter to find your meta tag.  
  • Verify that your keywords are displayed in the content attribute.  
  • Alternatively, you can use the W3C Markup Validator to validate your HTML code, including your meta tags.  
  • You can also use an extension called SEO Meta in 1 Click, which shows you all meta tags on a webpage at a glance. 

Best Practices for Adding Meta Keywords in WordPress 


It’s not just about stuffing in the keywords. How you put them in is just as important. Here are some tips on keeping your meta keywords clean and organized: 

  • Use a child theme: Make sure you always work in a child theme, so your modifications don’t get overridden when the original theme is updated. 
  • Keep keywords concise: Keep each page’s meta keywords concise and limited to 10-15 relevant keywords. While stuffing in meta tags won’t hurt your rankings, it’s considered bad practice. 
  • Prioritizing your primary keyword: It is important that you prioritize your primary keywords by placing them first in the content attribute of the meta keywords tag. 
  • Ensure keywords match the content: It is essential that the keywords used match the content perfectly. 
  • Updating: When you update or refresh the content, it’s also important to update the meta keywords accordingly. 
  • Sanitize code output: To prevent security vulnerabilities, it’s important to ensure that you always use the esc_attr() function to wrap any PHP content. 

When Should You Consider Using a Plugin Instead? 


It is good to understand how to do this in WordPress without using a plugin, but it is also important to recognize that, in some cases, using a plugin to do this can actually be better. 

  • You have multiple WordPress sites to handle.  
  • You do not want to edit any code in your WordPress site.  
  • You want to use other WordPress SEO features besides meta keywords. 
  • You want to allow multiple users to edit meta keywords in WordPress without requiring them to edit code. 

In such situations, lightweight SEO plugins can take care of meta keywords along with other SEO parameters without affecting site performance. For coders and developers, manual methods as discussed in this guide are always recommended. 


Conclusion


Adding meta keywords in WordPress without the use of any plugin is a more hands-on approach, which allows full control of the site’s HTML. Whether it is header.php for static meta keywords or functions.php with the wp_head hook for dynamic meta keywords, or custom fields for managing meta tags for certain pages, they have their own use. 

The best option will depend on the complexity of your site and your familiarity with PHP. If your site is small and static, changing the header.php file will likely be the fastest solution. If your blog or site contains a lot of content or spans multiple pages, the functions.php or custom fields methods will give you more flexibility. 

Remember, although Google does not use meta keywords as a ranking factor, it is important to have a well-structured HTML document, and in this regard, the use of meta keywords can help with performance in other search engines as well. It is always important to use a child theme, back up the site, and also verify the output in the page source.