Meta Keywords are a specific type of meta tag that appear in the HTML code of a Web page and help tell search engines what the topic of the page is. They look like this:

<head>
<meta name="keywords" content="meta keywords html, meta tag generator, meta tags example, meta tag attributes, meta tag in html">
</head>

The important thing to keep in mind when selecting or optimizing your meta keywords is to be sure that each keyword accurately reflects the content of your pages.
For some reason, WordPress doesn’t have built-in support for adding SEO keywords, which is why so many third-party plugins have been developed for this purpose. However, you don’t need to install another WordPress plugin to enable the keywords meta tag, as you’ll soon find out in this instructional guide below.

How to Add Keywords In WordPress Without Plugins

To add keywords in WordPress, please follow the steps below carefully.

Step 1.Add The Following Code to the functions.php File

Inside the WordPress dashboard Theme Editor or on the web server, find and open the functions.php file. Go to Appearance -> Theme Editor.

You must create a child theme before making any changes to functions.php file. Otherwise, the applied changes will be lost after each update.
Create child theme in WordPress step by step [without plugin]

As an alternative method, you can use the Code Snippets plugin to insert your codes into WordPress.

Copy the PHP code from the below box and paste it at the end of the functions.php file.

add_action('wp_head', function (){
if( is_single() || is_page() ) {
$meta_keywords_raw = (get_post_meta(get_the_ID(), 'keywords', true));
if ($meta_keywords_raw)	 {
$meta_keywords = preg_replace('/\s*,\s*/', ', ', $meta_keywords_raw);
?>
<meta name="keywords" content="<?= $meta_keywords; ?>">
<?php }} } );

This Is How the Above PHP Code Works

This code puts the keywords that you write in the custom fields in the meta keyword. There are other ways to add keywords, but in this method you will have the most control over the output.

Step 2.Open an existing Post and turn On the Custom Fields Option

Go to WordPress dashboard, then open an existing post to which you want to add meta keywords tag.

At the top right of your WordPress dashboard, you should see three dots. Click on those dots to open the WordPress options menu.
In the pop-up screen for Preferences, click on the “Panel” tab located on the left-hand side.
Under the “Additional” section, click on the “Custom Fields” toggle bar to toggle it to the on position. A page reload is required for this change. Make sure your content is saved before reloading. Then, click on the “Enable and Reload” button that appears.
After the page reloads, a “Custom Fields” section will appear below your WordPress text editor.

activate Custom fields in wordpress

Step 3.Create A Custom Field for Meta Keywords

Scroll down past the bottom of the WordPress text editor to the new “Custom Fields” section that was enabled in the previous step.
You should now see an “Add New Custom Field” area.

Here’s how you create the custom field for meta keywords:

  • Under the “Name” column, click on “Enter New” which is located below the “- Select -” dropdown menu.
  • In the text field that now appears under the “Name” column, type in “keywords”. This will assign a custom field for the meta keywords.
  • In the text field under the “Value” column, type in the keywords you want to be displayed in the meta keywords HTML tag with commas separating each phrase.
  • Click on the “Add Custom Field” button to save this new custom field for the meta keywords.
Add keywords in WordPress Custom Field

Step 4.Update the post and check the result

Go to the post and open the source code by pressing Ctrl+U keys and check the correctness of the keywords meta tag.

meta keywords tag in WordPress

If this article is difficult for you to read in text, you can watch the video version below.

How many keywords should I add to my posts to optimize them for search engines?

There isn’t a specific number of keywords you should add to your posts, as the effectiveness of your keyword usage depends on the quality and relevance of the content. Instead of focusing on a specific quantity of keywords, aim to use keywords naturally within your content, meta tags, and other relevant areas. It’s generally recommended to focus on a few primary keywords and their variations (synonyms, long-tail keywords, etc.) to avoid keyword stuffing and provide a better user experience.

Can I use the same keywords for multiple posts or pages on my WordPress website?

While it is possible to use the same keywords for multiple posts or pages on your WordPress website, it’s generally not recommended. Using the same keywords across different pages can lead to keyword cannibalization, where search engines might struggle to determine which page is the most relevant for a particular keyword. To avoid this, focus on using unique keywords or variations for each post or page, ensuring that your content remains relevant and targeted to the specific topic.

Is it necessary to add keywords to every post and page on my WordPress website?

While adding keywords can be beneficial for SEO, it’s not strictly necessary to add them to every post and page on your WordPress website. Focus on creating high-quality, relevant content that provides value to your audience, and incorporate keywords naturally within the content when it makes sense. For pages with less content or for pages where adding keywords feels forced, it’s better to prioritize user experience over trying to fit in specific keywords. Remember that search engines are becoming increasingly sophisticated and prioritize valuable content over excessive keyword usage.

Share this post
Maya
Maya

Hi, my name is Maya and I’m a WordPress plugin developer. I created this website to share some of the helpful codes that I’ve used in my own projects.
If you’re looking for a custom plugin for your website, you can contact me by clicking on Hire a developer in the menu. I’d love to hear from you.

Articles: 56

3 Comments

  1. Interestingly supportive in adding keywords. How long do the keywords take to reflect on keyword tools like Moz? Thank you

    • After adding new keywords to your website, it can take a few weeks for them to appear in keyword research tools like Moz. The process involves search engines crawling and indexing your site, followed by the tool updating its database, which can take time.

Leave a Reply

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