How to Add Meta Keywords and Meta Descriptions in WordPress
Meta descriptions are HTML attributes that summarize a page's content for search engines and users — they appear as the snippet text beneath your page title in search results and directly influence click-through rates. Meta keywords, once a core ranking signal, are now largely ignored by Google but remain referenced by Bing, Yandex, and several niche crawlers. Knowing how to implement both correctly — and when not to bother — is a foundational WordPress SEO skill that separates competent site owners from those chasing outdated advice.
This guide covers three implementation methods in full technical depth: the Yoast SEO plugin, the Rank Math SEO plugin, and manual theme-level editing. It also addresses the architectural tradeoffs between each approach, common pitfalls that silently break your metadata, and a clear decision matrix for choosing the right method for your setup.
Why Meta Tags Still Matter in 2025
Google's John Mueller confirmed years ago that the <meta name="keywords"> tag carries zero weight in Google's ranking algorithm. That statement is accurate — but incomplete. The broader picture:
- Meta descriptions are not a direct ranking factor, but they are the primary lever for improving organic click-through rate (CTR). A well-written description can increase CTR by 5–10%, which feeds positive engagement signals back into rankings.
- Meta keywords are still parsed by Bing's crawler, Yandex, Baidu, and DuckDuckGo's supplementary index. For sites targeting non-Google traffic or operating in specific regional markets, they carry marginal but real value.
- AI Overviews and Perplexity use structured page metadata as a confidence signal when generating cited summaries. A clear, keyword-aligned meta description improves the probability that your page is cited accurately.
- Social sharing relies on Open Graph and Twitter Card tags, which are closely related to meta descriptions and often populated from the same plugin fields.
The performance of your metadata is also inseparable from your server's response speed. A page that loads in under 200ms will have its metadata indexed and rendered in search results far more reliably than a slow-loading page. Running WordPress on a properly configured VPS Hosting environment with NVMe storage ensures that Googlebot completes crawls without timing out, which directly affects how consistently your meta tags appear in SERPs.
Method 1: Yoast SEO Plugin
Yoast SEO is the most widely deployed WordPress SEO plugin, with over 10 million active installations. It injects metadata at the template level using WordPress hooks, meaning it does not require you to touch any theme files directly.
Step 1: Install and Activate Yoast SEO
- Log in to your WordPress admin dashboard.
- Navigate to Plugins > Add New.
- Search for
Yoast SEO. - Click Install Now, then Activate.
After activation, a new SEO menu item appears in the left sidebar.
Step 2: Configure Global SEO Settings
Before editing individual posts, configure the global defaults under SEO > Search Appearance. These defaults apply to any post or page that does not have a custom meta description set — they are your fallback and should not be left blank.
Under Content Types, you can define title and description templates using Yoast's variable system. For example:
%%title%% %%page%% %%sep%% %%sitename%%These variables dynamically populate based on the post's actual title and your site name, which is preferable to static global strings.
Step 3: Enable Meta Keywords (Optional)
Yoast removed the meta keywords field from its UI in version 7.0 (released 2018), citing Google's explicit deprecation of the tag. If you are running a current version of Yoast, the field is not available in the standard interface.
If you need meta keywords for Bing or Yandex targeting, you have two options:
- Use a secondary plugin such as WP Meta SEO or SEOPress alongside Yoast specifically for the keywords field.
- Add the tag manually via a child theme or a custom
wp_headhook (covered in Method 3).
Attempting to re-enable meta keywords by modifying Yoast's core plugin files is not recommended — updates will overwrite your changes.
Step 4: Add a Meta Description to a Post or Page
- Open the post or page editor (Gutenberg or Classic Editor).
- Scroll below the content editor to the Yoast SEO meta box.
- Click the Google preview section to expand it.
- Click Edit snippet.
- In the Meta description field, enter your custom description.
Character guidance: Aim for 120–158 characters. Google truncates descriptions at approximately 920 pixels of rendered width, which corresponds to roughly 158 characters in a standard font. Descriptions under 120 characters often get rewritten by Google using on-page content.
Yoast provides a real-time character counter and a colored indicator (red/orange/green) to guide you.
Step 5: Save Your Changes
Click Update or Publish. Yoast writes the tag to the <head> section on the next page load. You can verify the output immediately by viewing the page source (Ctrl+U in most browsers) and searching for meta name="description".
Method 2: Rank Math SEO Plugin
Rank Math is a strong alternative to Yoast, particularly for users who want schema markup, keyword tracking, and meta keywords support within a single plugin. Its free tier includes features that Yoast reserves for its premium plan.
Step 1: Install and Activate Rank Math
- Navigate to Plugins > Add New in your WordPress dashboard.
- Search for
Rank Math SEO. - Click Install Now, then Activate.
Rank Math will launch a Setup Wizard on first activation. Complete it — the wizard configures your sitemap, robots settings, and default title templates. Skipping it leaves your site with suboptimal defaults.
Step 2: Enable Meta Keywords
Unlike Yoast, Rank Math retains the meta keywords field but hides it behind a setting:
- Go to Rank Math > General Settings.
- Open the Titles & Meta section.
- Locate Use Meta Keywords Tag and toggle it On.
- Click Save Changes.
Once enabled, a Meta Keywords field appears in the Rank Math meta box on every post and page editor.
Step 3: Add Meta Description and Keywords to a Post
- Open the post or page editor.
- Scroll to the Rank Math SEO meta box below the editor.
- Click Edit Snippet inside the General tab.
- Enter your description in the Description field.
- If meta keywords are enabled, enter them in the Focus Keywords or Meta Keywords field, separated by commas.
Rank Math also provides a Content AI feature that suggests LSI keywords based on your focus keyword — useful for ensuring your description aligns with the semantic context of the page.
Step 4: Save Your Changes
Click Update or Publish. Rank Math outputs the meta tags via the rank_math/head hook, which fires within the <head> block.
Method 3: Manual Meta Tag Implementation Without a Plugin
This method is appropriate for developers building custom themes, headless WordPress setups, or environments where plugin overhead must be minimized. It requires direct PHP editing and carries a higher risk of site-breaking errors if done incorrectly.
Critical prerequisite: Always work on a child theme. Editing a parent theme's files directly means any theme update will overwrite your changes. If you do not have a child theme active, create one before proceeding.
Step 1: Access the Theme Editor or File System
Via WordPress Dashboard (not recommended for production):
- Go to Appearance > Theme Editor.
- Select
header.phpfrom the file list on the right.
Via SSH or SFTP (recommended):
Navigate to your theme directory and open header.php in a text editor:
nano /var/www/html/wp-content/themes/your-child-theme/header.phpStep 2: Add Meta Tags to the <head> Section
Locate the <head> block and add your tags before the closing </head> tag. A static implementation looks like this:
<meta name="description" content="Your meta description here" />
<meta name="keywords" content="keyword1, keyword2, keyword3" />The critical limitation of static tags: This inserts identical metadata on every page of your site, which is an SEO anti-pattern. Search engines penalize duplicate metadata across multiple URLs. The correct approach for a custom theme is to use WordPress's conditional tags and custom fields to output per-page metadata dynamically:
<?php
$meta_description = get_post_meta( get_the_ID(), '_meta_description', true );
$meta_keywords = get_post_meta( get_the_ID(), '_meta_keywords', true );
if ( ! empty( $meta_description ) ) : ?>
<meta name="description" content="<?php echo esc_attr( $meta_description ); ?>" />
<?php endif;
if ( ! empty( $meta_keywords ) ) : ?>
<meta name="keywords" content="<?php echo esc_attr( $meta_keywords ); ?>" />
<?php endif; ?>This snippet reads from custom post meta fields (_meta_description, _meta_keywords) that you populate per-post using a custom metabox or the Custom Fields panel in the post editor.
Note the use of esc_attr() — this is a security-critical sanitization function that prevents XSS injection through malformed metadata values. Never output raw post meta directly into HTML attributes.
Step 3: Save and Verify
If editing via the dashboard, click Update File. If editing via SSH:
# Verify the file saved correctly
grep -n "meta name" /var/www/html/wp-content/themes/your-child-theme/header.phpThen check the rendered output in a browser:
curl -s https://yourdomain.com/ | grep -i "meta name"Plugin vs. Manual: Comparison Table
| Criteria | Yoast SEO | Rank Math SEO | Manual (Custom Theme) |
|---|---|---|---|
| — | — | — | — |
| Per-page meta description | Yes | Yes | Yes (requires custom fields) |
| Meta keywords field | Removed (v7.0+) | Yes (optional) | Yes (full control) |
| Schema markup | Yes (premium for advanced) | Yes (free tier) | Manual only |
| Open Graph / Twitter Cards | Yes | Yes | Manual only |
| XML sitemap | Yes | Yes | Requires separate plugin |
| Performance overhead | Moderate | Moderate | Minimal |
| Update safety | Automatic | Automatic | Requires child theme |
| Technical skill required | Low | Low | High |
| Suitable for multisite | Yes | Yes | Complex |
| AI Overview optimization | Good (structured output) | Good (structured output) | Depends on implementation |
Best Practices for Meta Descriptions
Length and truncation:
- Target 120–158 characters for desktop SERPs.
- Mobile SERPs truncate earlier — around 105–120 characters. If mobile traffic dominates your analytics, front-load the most important information.
- Google rewrites approximately 60–70% of meta descriptions when it determines the existing description does not match the user's query intent. This is not a failure — it means your on-page content is being used, but it underscores the importance of writing descriptions that closely mirror your
<h1>and opening paragraph.
Content structure:
- Place your primary keyword within the first 60 characters so it appears before truncation.
- Use active voice and a clear value proposition: what the user will learn or gain by clicking.
- Avoid duplicating your page title verbatim — the description should complement, not repeat.
- Do not include structured data markup (JSON-LD, microdata) inside the description field — that belongs in a separate
<script type="application/ld+json">block.
What to avoid:
- Quotation marks inside the
contentattribute value — they break the HTML attribute and cause the description to be truncated at the quote character. - All-caps text — it reads as spam to both users and some crawlers.
- Generic filler phrases like "Welcome to our website" or "Click here to learn more."
Best Practices for Meta Keywords
Meta keywords require less strategic investment than descriptions, but if you use them, use them correctly:
- Limit to 3–7 keywords per page. More than that signals keyword stuffing to the crawlers that still parse the field.
- Use the exact phrases that appear in your page's body content — do not introduce keywords that have no on-page presence.
- Separate values with commas and a space:
keyword one, keyword two, keyword three. - Do not repeat the same keyword in different forms (e.g.,
VPS hosting, VPS host, VPS hosts) — this is the pattern that caused Google to deprecate the tag in the first place. - For sites targeting Russian-language audiences or Eastern European markets, Yandex's
<meta name="keywords">parsing is documented and active. If your WordPress site runs on infrastructure serving those regions — for example, on a Dedicated Server in a European data center — the tag is worth maintaining.
Server-Side Considerations That Affect Meta Tag Indexing
Meta tags are rendered in the HTML <head> — which means they are only reliably indexed if Googlebot can fully retrieve and parse your page's HTML. Several server-level factors affect this:
TTFB (Time to First Byte): Googlebot has a crawl budget. Pages with a TTFB above 500ms are crawled less frequently. The <head> block is delivered first in the HTML stream, so a fast server ensures metadata is received even if Googlebot times out before the full body loads. Hosting WordPress on a VPS with cPanel with PHP-FPM and OPcache enabled typically reduces TTFB to under 100ms.
HTTPS enforcement: Google gives a minor ranking preference to HTTPS pages. More importantly, a mixed-content warning or an invalid SSL certificate causes browsers to display security warnings, which increases bounce rate and suppresses CTR — negating the benefit of a well-crafted meta description. Ensure your SSL Certificate is valid, auto-renewing, and covers all subdomains used by your WordPress installation.
Caching layers: If you use a full-page cache (WP Rocket, W3 Total Cache, or server-level Nginx FastCGI cache), ensure that the cache is purged when you update a post's meta description. A stale cache will serve the old description to Googlebot until the cache expires, which can delay SERP updates by hours or days.
Robots.txt and noindex tags: A common misconfiguration is accidentally setting noindex on pages you want indexed, or blocking Googlebot from crawling your CSS and JS files (which prevents Google from rendering the page and confirming your meta tags). Audit your robots.txt and Yoast/Rank Math noindex settings after any major plugin update.
Verifying Your Meta Tags Are Live
After adding or updating meta tags, verify the output through multiple channels:
Browser source inspection:
curl -s -A "Googlebot/2.1" https://yourdomain.com/your-page/ | grep -i "meta name"Using Googlebot's user-agent string tests what the crawler actually receives, bypassing any user-agent-based caching rules.
Google Search Console: Use the URL Inspection tool to fetch a live version of the page. The rendered HTML tab shows exactly what Googlebot sees, including your meta description. If the description shown in Search Console differs from what you set in Yoast or Rank Math, a caching or hook conflict is the likely cause.
Third-party validators: Tools like Screaming Frog SEO Spider, Ahrefs Site Audit, or the SERP Simulator at SERPsim.com let you preview how your title and description render across different device types before they appear in live search results.
Decision Matrix: Choosing the Right Implementation Method
| Scenario | Recommended Method |
|---|---|
| — | — |
| Standard WordPress blog or business site | Yoast SEO or Rank Math |
| Need meta keywords for Bing/Yandex targeting | Rank Math (keywords field built-in) |
| Custom theme development, no plugin overhead | Manual PHP with custom post meta |
| Multisite network with centralized SEO management | Rank Math (network-level settings) |
| Headless WordPress (REST API or GraphQL) | Manual via custom post meta + REST API exposure |
| Site already using Yoast, needs keywords field | Add SEOPress or WP Meta SEO alongside Yoast |
| Shared hosting with plugin restrictions | [Shared Web Hosting](https://alexhost.com/shared-hosting/) + Yoast (low resource usage) |
Technical Key-Takeaway Checklist
- Confirm your active theme is a child theme before making any manual edits to
header.php. - After installing Yoast or Rank Math, check Search Appearance > Content Types to ensure default title and description templates use dynamic variables, not static strings.
- Set meta descriptions to 120–158 characters — not 150–160 as commonly cited — to account for mobile truncation.
- Use
esc_attr()on any meta tag value output from PHP to prevent XSS vulnerabilities. - Purge your full-page cache after every meta description update to ensure Googlebot receives the new version on its next crawl.
- Validate your SSL certificate is active and auto-renewing — a certificate error suppresses CTR regardless of description quality.
- Run
curlwith Googlebot's user-agent string to confirm the meta tags are visible to crawlers, not just logged-in users. - For Yandex or Bing-targeted content, enable meta keywords in Rank Math and limit entries to 5 per page.
- Use Google Search Console's URL Inspection tool to confirm the description appearing in Search Console matches what you set in your plugin.
- Do not add meta keywords to pages you intend to rank in Google — the tag is ignored and adds no value for that engine.
Frequently Asked Questions
Does Google use meta keywords for ranking in 2025?
No. Google officially stopped using the <meta name="keywords"> tag as a ranking signal in 2009. Adding it to your pages has no positive or negative effect on Google rankings. Bing and Yandex still parse the field, so it retains value for sites targeting those engines.
Why does Google rewrite my meta description even after I set it in Yoast?
Google rewrites descriptions when it determines that the existing description does not accurately match the user's search query. This happens on approximately 60–70% of pages. It is not a plugin malfunction — it means Google is pulling a more relevant excerpt from your page body. The fix is to align your description more closely with the primary keyword intent of the page.
Can I have different meta descriptions for desktop and mobile?
No. HTML meta tags are served from a single <head> block regardless of device. Google's mobile-first indexing uses the same metadata as desktop. The only difference is display truncation — mobile SERPs show fewer characters. Write your description so the most critical information appears within the first 105 characters.
What happens if two plugins both output a meta description tag?
You will have duplicate <meta name="description"> tags in your HTML. Google and other crawlers typically use the first instance they encounter, but the behavior is undefined and inconsistent. This is a common conflict when migrating from one SEO plugin to another without fully deactivating the old one. Always deactivate and delete the previous SEO plugin before activating a replacement.
Is it safe to edit header.php directly in the WordPress Theme Editor?
For production sites, no. The Theme Editor provides no version control, no syntax error checking, and a single mistake can render your site inaccessible. Use SSH access to edit files on a VPS Hosting environment, maintain a Git repository for your theme, and always test changes on a staging environment before deploying to production.
