SEO & Analytics

How to Add Meta Keywords in WordPress without Plugin

Add the old meta keywords tag using safe code snippets and custom fields—no SEO plugin required.

The meta keywords tag is one of those persistent SEO myths in WordPress. Most modern search engines ignore it, yet you may still need it for legacy systems, internal search tools, or specific regional search engines. The good news: you can add meta keywords in WordPress without installing yet another plugin.

In this tutorial, you’ll learn how to add a clean, per-post <meta name="keywords"> tag using a small code snippet and WordPress custom fields. By the end, you’ll be able to manage meta keywords directly in the editor while keeping your theme fast and uncluttered.

If you’re new to optimization in general, it can help to first understand what SEO on WordPress really means, then come back here for this optional, more advanced tweak.

Prerequisites

Before you start editing code, make sure you have the basics in place. You don’t need to be a developer, but you do need to be comfortable copying and pasting small snippets.

  • Administrator access to your WordPress dashboard.
  • Access to your theme files via FTP/SFTP or your hosting file manager.
  • A child theme active (recommended) so theme updates don’t overwrite your changes.
  • Classic Editor or familiarity with enabling Custom Fields in the Block Editor.
Warning: Editing theme files directly on a live site can cause errors if you paste code incorrectly. Always take a quick backup or create a staging copy before you change functions.php.

Step 1: Decide Whether You Really Need Meta Keywords Wordpress

Before you write any code, decide why you want meta keywords at all. Google, Bing, and many major search engines no longer use this tag for rankings. However, some legacy tools, older search engines, and custom site search implementations may still rely on it.

Use meta keywords only when you have a clear reason—such as integrating with a third-party system or maintaining compatibility with an older SEO setup. More importantly, make sure you’re using keywords correctly on the page itself. Our guide on adding keywords in WordPress without hurting your SEO walks through how to choose phrases that help rather than harm.

As a rule of thumb, keep each post’s meta keywords list short and focused—usually 3–8 phrases, separated by commas, that truly reflect the content of that page.

Step 2: Enable Custom Fields in the Editor

To avoid hard-coding keywords, you’ll store them in a custom field on each post or page. First, make sure the Custom Fields panel is visible in your editor.

2.1 Enable Custom Fields in the Classic Editor

  1. Log in to your WordPress dashboard and edit any post.
  2. At the top right, click Screen Options.
  3. In the dropdown panel, check the box labeled Custom Fields.
  4. Close the Screen Options panel; the Custom Fields box should now appear below the content editor.

2.2 Enable Custom Fields in the Block Editor (Gutenberg)

  1. Edit a post or page in the Block Editor.
  2. Click the three-dot Options menu at the top right.
  3. Choose PreferencesPanels.
  4. Enable the Custom fields option, then reload the editor when prompted.
  5. Scroll down below the content area to find the Custom Fields panel.
Note: On some setups, Custom Fields may be disabled by performance plugins or custom admin tweaks. If you don’t see the panel after enabling it, check with your developer or host.

Step 3: Add a Meta Keywords Field to Your Post

Now you’ll create a reusable custom field that will hold your comma-separated meta keywords for each post. You’ll only need to create the field name once; afterward, you’ll just fill in the value.

  1. With the post open, scroll down to the Custom Fields box.
  2. If you don’t have any fields yet, click Enter new.
  3. In the Name box, enter meta_keywords (all lowercase, underscore instead of space).
  4. In the Value box, enter a few relevant keywords separated by commas, for example:
    wordpress meta keywords, seo settings, custom meta tags
  5. Click Add Custom Field, then update or publish your post.
Pro Tip: Use the same meta_keywords field name on every post so your code only has to look for a single key.

Step 4: Add a Meta Keywords Snippet to functions.php

Next, you’ll hook into WordPress’s wp_head action so your site automatically prints the meta keywords tag in the <head> area whenever a post has the meta_keywords field filled in.

4.1 Open Your Child Theme’s functions.php

  1. Connect to your site via FTP/SFTP or open your hosting file manager.
  2. Navigate to wp-content/themes/your-child-theme/.
  3. Download or open the functions.php file in a text editor.
Warning: Avoid editing the parent theme’s functions.php in Jannah or any other theme. Updates will overwrite your changes. Always use a child theme or a custom functionality file.

4.2 Paste the Meta Keywords Function

Inside functions.php, add the following code near the bottom of the file, but still inside the opening <?php tag:

// Add meta keywords from a custom field to the <head>
function wph_meta_keywords_tag() {
    if ( ! is_singular() ) {
        return;
    }

    global $post;
    $keywords = get_post_meta( $post->ID, 'meta_keywords', true );

    if ( empty( $keywords ) ) {
        return;
    }

    echo '<meta name="keywords" content="' . esc_attr( $keywords ) . '" />' . "\n";
}
add_action( 'wp_head', 'wph_meta_keywords_tag' );

Save the file and, if you edited it locally, upload it back to your child theme directory. Then refresh your site to make sure there are no PHP errors.

Note: If you see a “critical error” after saving, restore the previous version of functions.php from your backup and check for missing semicolons, curly braces, or stray characters.

If you’re also interested in controlling other meta tags like description or robots, you can combine this approach with our guide on adding meta tags in WordPress for a more complete setup.

Step 5: Test That the Meta Keywords Tag Is Working

With the code in place, it’s time to confirm your meta keywords are actually being output in the HTML head of your pages.

  1. Open a post where you added the meta_keywords custom field in your browser.
  2. Right-click anywhere on the page and choose View Page Source (or press Ctrl + U / Cmd + Option + U).
  3. Use the find function (Ctrl + F / Cmd + F) and search for meta name="keywords".
  4. You should see a line similar to:
    <meta name="keywords" content="wordpress meta keywords, seo settings, custom meta tags" />

If the tag isn’t there, double-check that you saved functions.php, that the child theme is active, and that the post actually has a meta_keywords custom field set.

Step 6: Maintain and Clean Up Meta Keywords WordPress Over Time

Once everything works, treat meta keywords as a secondary, “nice-to-have” layer rather than your primary SEO tool. Update them when you significantly change the focus of a post, but don’t obsess over minor tweaks.

  • Avoid keyword stuffing: Very long lists of keywords can be a red flag in audits and offer little benefit.
  • Keep them aligned: Your meta keywords should match the real topic and phrases used in your title, headings, and body content.
  • Review periodically: When you update content, quickly review the meta_keywords field and remove outdated phrases.
  • Be ready to remove: If your SEO strategy changes, you can safely remove the function later; it won’t affect your visible content.
Pro Tip: Focus most of your time on high-impact optimizations—content quality, internal links, and performance—and treat meta keywords as a low-priority compatibility feature.

Wrap Up: Meta Keywords WordPress Without a Plugin

You’ve just configured Meta Keywords WordPress to output the meta keywords tag using a lightweight, plugin-free approach. By combining a custom field with a simple functions.php snippet, you stay in control of your code and avoid bloating your site with extra SEO plugins.

Remember that meta keywords are no longer a major ranking factor, so treat them as a bonus layer rather than a core strategy. Keep your keyword lists concise, aligned with your content, and maintained over time, and your WordPress site will stay both clean and flexible for future SEO changes.

Further Reading

Frequently Asked Questions

Do meta keywords still matter for SEO today?

For major search engines like Google and Bing, the meta keywords tag is no longer a ranking factor. They ignore it because it was abused in the past. However, some legacy systems, smaller search engines, and custom search tools may still read it.That’s why this tutorial focuses on adding meta keywords safely without hurting performance or cluttering your setup. If you don’t have a specific reason to use them, prioritize your title tags, meta descriptions, content quality, and internal linking instead.

Will adding meta keywords slow down my WordPress site?

No, this approach will not noticeably slow down your site. The function only runs on singular posts and pages, and it simply reads one custom field per page load. Compared to heavy SEO plugins, this snippet is minimal.If your site is slow, it’s almost always due to larger issues like unoptimized images, slow hosting, or excessive plugins—not a single meta tag.

My meta keywords tag is not showing in the source code. What went wrong?

First, confirm three things: (1) your child theme is active, (2) the wph_meta_keywords_tag function is in the child theme’s functions.php, and (3) the post you’re checking has a meta_keywords custom field with a value.If all of that looks correct and the tag still doesn’t appear, temporarily switch to a default theme (like Twenty Twenty-Four) on a staging site and test again. If it works there, your main theme or another plugin may be filtering or overriding the wp_head output.

Is it safe to edit functions.php directly on a live site?

It’s technically possible but not ideal. A small syntax error in functions.php can trigger a “critical error” and lock you out of the admin area until it’s fixed via FTP. That’s why it’s safer to use a child theme and edit files via SFTP or your hosting file manager.Always keep a backup of the original functions.php file before making changes, and test major edits on a staging site when possible.

Can I remove the meta keywords code later without breaking anything?

Yes. If you decide meta keywords are no longer needed, you can simply remove the wph_meta_keywords_tag function and its add_action line from functions.php. Your posts will continue to work normally, and only the meta keywords tag will disappear from the page source.The custom field values will remain stored in the database, so you can always re-enable the function or repurpose those values in the future if necessary.

Related Articles

Leave a Reply

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

Back to top button