Meta keywords have traditionally been used in HTML to provide search engines with additional information about the content of a web page. Although their importance has diminished over the years due to changes in search engine algorithms, some webmasters still choose to include meta keywords as part of their SEO strategy. Adding meta keywords in WordPress without using a plugin can be accomplished by manually editing your theme files. This article will guide you through the process of adding meta keywords manually, ensuring your site remains optimized.
Meta keywords are a type of meta tag that appear in the HTML code of a web page. They are intended to offer search engines a list of keywords that are relevant to the page's content. Although Google no longer uses meta keywords for ranking purposes, other search engines like Bing might still consider them. Therefore, adding meta keywords can still be part of a comprehensive SEO strategy.
To add meta keywords manually in WordPress, you will need to edit your theme's header file. Here are the steps:
yourwebsite.com/wp-admin
and log in with your credentials.Appearance
> Theme Editor
. This will open the Theme Editor where you can access your theme files.header.php
file in the list of theme files on the right side. This file controls the head section of your WordPress site.<head>
Section:
header.php
file, locate the opening <head>
tag. You will add your meta keywords within this section.<head>
tag:<meta name="keywords" content="keyword1, keyword2, keyword3">
keyword1
, keyword2
, keyword3
with your relevant keywords. Make sure to separate each keyword with a comma.Update File
button to save your changes.To make the process more efficient, especially for individual posts or pages, you can add meta keywords dynamically using custom fields and PHP code.
Custom Fields
section.Add New
and create a field named meta_keywords
.header.php
file, add the following PHP code within the <head>
section to dynamically include meta keywords from custom fields:if (is_single() || is_page()) {
$meta_keywords = get_post_meta(get_the_ID(), 'meta_keywords', true);
if ($meta_keywords) {
echo '<meta name="keywords" content="' . esc_attr($meta_keywords) . '">';
}
}
meta_keywords
custom field and, if so, inserts it into the head section of the HTML.After adding the meta keywords, it?s important to verify that they are correctly implemented:
Inspect
or View Page Source
to check the HTML code.<head>
section to confirm it is present and correct.Test Different Posts and Pages:
Adding meta keywords in WordPress without a plugin involves editing your theme?s header.php
file and possibly using custom fields for dynamic keyword insertion. While meta keywords may not be as crucial for SEO as they once were, they can still play a role in a comprehensive SEO strategy. By following the steps outlined in this guide, you can manually add meta keywords to your WordPress site, ensuring that it remains optimized for search engines that still consider meta keywords. Always remember to keep your keywords relevant, avoid keyword stuffing, and update them regularly to maintain effective SEO practices.