How to add Meta Keywords in WordPress Without Plugin?

Today, it’s very important to make sure that search engines can find your website. Meta keywords are a short but strong tool that helps search engines understand what your site is about and how it works.

They are an important part of the optimization process. Many plugins for WordPress can make this job easier, but some users like to do things by hand.

This guide will go over everything you need to know to add meta keywords to your WordPress site without using tools.

What are meta-keywords?

Let’s get a good grasp on what meta keywords are before we get into the technical stuff. Some websites have short sentences or words that sum up the main points of a page or the whole website.

These terms help search engines understand what your content is about and how relevant it is. This affects how it is ranked and shown in search results.

The Importance of Meta Keywords

While meta keywords may not directly influence search engine rankings as they once did, they still play a pivotal role in your website’s overall SEO strategy. By carefully curating and implementing these keywords, you can:

  • Enhance Content Relevance: Accurately representing your content’s focus helps search engines deliver more pertinent results to users, increasing the likelihood of attracting your target audience.
  • Boost Click-Through Rates: Well-crafted meta descriptions, which often incorporate meta keywords, can entice users to click through from search results, driving more traffic to your site.
  • Improve User Experience: By aligning your meta keywords with the content users expect, you can reduce bounce rates and encourage longer engagement on your site.
  • Establish Brand Identity: Consistent use of meta keywords across your site reinforces your brand’s identity and helps search engines associate your content with specific topics or industries.

Preparing for Meta Keyword Implementation

Before diving into the technical aspects of adding meta keywords to your WordPress site, it’s essential to lay the groundwork by conducting thorough keyword research.

This process involves identifying the most relevant and high-performing keywords for your niche, products, or services.

Numerous tools are available to assist with keyword research, including Google’s Keyword Planner, Ahrefs, SEMrush, and Moz Keyword Explorer. These tools provide insights into search volume, competition levels, and related terms, enabling you to curate a comprehensive list of meta keywords tailored to your site’s content.

Adding Meta Keywords to WordPress Without Plugins

Now that you understand the significance of meta keywords and have a list of relevant terms, it’s time to implement them on your WordPress site without relying on plugins.

This process involves editing your site’s core files, so it’s crucial to exercise caution and create a backup before proceeding.

Step 1: Accessing the header.php File

The first step is to locate and open the header.php file within your WordPress theme’s directory. This file contains the HTML code that defines the header section of your website, including meta tags.

You can access the header.php file using a File Transfer Protocol (FTP) client or the built-in File Manager in your WordPress dashboard. Navigate to wp-content/themes/your-theme-name and locate the header.php file.

Step 2: Inserting the Meta Keywords Tag

Once you’ve opened the header.php file, locate the <head> section. This is where you’ll insert the meta keywords tag for your entire website.


Copy code


<!– Other meta tags and code –>

<meta name=”keywords” content=”primary keyword, secondary keyword 1, secondary keyword 2″>

<!– Additional code:


Replace “primary keyword, secondary keyword 1, secondary keyword 2” with your carefully curated list of meta keywords, separated by commas. Ensure that your primary keyword is listed first, followed by relevant secondary keywords.

Step 3: Adding Dynamic Meta Keywords for Individual Posts and Pages

While the previous step covered meta keywords for your entire site, you may want to customize these keywords for specific posts or pages. This can be achieved by incorporating a WordPress function into your theme’s functions.php file.

First, locate the functions.php file within your theme’s directory (wp-content/themes/your-theme-name/functions.php). Then, add the following code snippet:


Copy code

function custom_meta_keywords() {

global $post;

$keywords = ”;

$tags = get_the_tags($post->ID);

if ($tags) {

for each ($tags as $tag) {

$keywords .= $tag->name . ‘, ‘;



$categories = get_the_category($post->ID);

if ($categories) {

for each ($categories as $category) {

$keywords = $category->name . ‘, ‘;



$keywords = trim($keywords, ‘, ‘);

echo ‘<meta name=”keywords” content=”‘ . $keywords. ‘”>’;


add_action(‘wp_head’, ‘custom_meta_keywords’);

This function dynamically generates meta keywords for each post or page based on the assigned tags and categories. It retrieves the names of the associated tags and categories.

It combines them into a comma-separated list, which is then outputted as the content attribute of the <meta name=”keywords”> tag.

By adding this function to your functions.php file, WordPress will automatically generate and display unique meta keywords for each post or page, improving the relevance and accuracy of your site’s SEO efforts.

Step 4: Customising Meta Keywords for Specific Pages or Posts

In some cases, you may want to specify meta keywords for certain high-priority pages or posts manually. This can be achieved by adding a custom field to the post or page editor.

First, install and activate a plugin like Advanced Custom Fields (ACF) or similar, which allows you to create custom fields in WordPress.

Next, create a new custom field for meta keywords within the plugin’s interface. Once the field is set up, you can access it when editing a post or page and enter your desired meta keywords.

Finally, modify the custom_meta_keywords() function in your functions.php file to check for the presence of the custom field and use its value as the meta keyword if it exists. Here’s an example:


Copy code

function custom_meta_keywords() {

global $post;

$keywords = get_post_meta($post->ID, ‘custom_meta_keywords’, true);

if (!empty($keywords)) {

echo ‘<meta name=”keywords” content=”‘ . esc_attr($keywords) . ‘”>’;



// Rest of the function code…


In this updated function, we first check if the custom field custom_meta_keywords exists for the current post or page. If it does, we use its value as the meta keywords and output it directly.

If the custom field is empty or doesn’t exist, the function falls back to generating meta keywords based on tags and categories, as in the previous example.

By following these steps, you can efficiently implement meta keywords on your WordPress site without relying on plugins while still maintaining flexibility and control over the process.

Best Practices for Meta-Keyword Optimization  

While implementing meta keywords is crucial, optimizing their usage is equally important. Here are some best practices to consider:

  • Prioritise Relevance: Ensure that your meta keywords accurately reflect the content of the corresponding page or post. Irrelevant or misleading keywords can negatively impact user experience and search engine rankings.
  • Embrace Specificity: Instead of using broad, generic terms, opt for more specific and long-tail keywords that better capture the essence of your content and target audience.
  • Limit Keyword Count: While there is no strict limit on the number of meta keywords you can include, keeping the list concise is generally recommended, with no more than 10–15 keywords per page or post.
  • Refresh Periodically: As your content evolves and your target audience shifts, revisit and update your meta keywords regularly to ensure they remain relevant and effective.
  • Avoid Keyword Stuffing: Resist the temptation to overload your meta keywords with repetitive or irrelevant terms in an attempt to manipulate search engine rankings. This practice, known as keyword stuffing, can lead to penalties and a poor user experience.
  • Incorporate branding: When appropriate, include your brand name or product names as meta keywords to reinforce your brand identity and make it easier for users to find you through branded searches.
  • Monitor and analyze: Regularly monitor your site’s performance and analyze user behaviour to identify which meta keywords are driving the most traffic and engagement. Use this data to refine and optimize your keyword strategy over time.

By adhering to these best practices, you can ensure that your meta keywords are working effectively to enhance your site’s visibility, attract your target audience, and ultimately drive more traffic and conversions.


Implementing meta-keywords on your WordPress site without relying on plugins may seem daunting at first. Still, with the right approach and attention to detail, it can be a rewarding endeavour.

By following the steps outlined in this guide, you’ll not only gain a deeper understanding of your site’s inner workings but also unlock the potential to optimize your site’s SEO and improve its overall performance.


Meta keywords are a type of metadata that describes the content of a webpage or website. Search engines use them to help understand what a page is about and determine its relevance for certain queries.

While they used to be an important factor in search engine rankings, meta keywords are no longer a major ranking factor. However, they can still be useful for improving the relevance and accuracy of your site’s content.

You can add meta keywords to your WordPress site by editing the code in your functions.php file, or by using a plugin that allows you to add custom fields for meta keywords.

It is generally recommended to limit the number of meta keywords to 10-15 per page. This ensures that you are using relevant and specific keywords without overloading the page.

Leave a Comment