How to Add Meta Tags and Keywords in WordPress (With or Without a Plugin)

WordPress metadata labels revealed under a blue webpage

To add meta tags in WordPress, install an SEO plugin and fill in the SEO title and meta description in each post’s snippet editor, then set your homepage tags and any site verification codes in the plugin’s settings. Without a plugin, add the tags to your site’s <head> with a short code snippet on the wp_head hook. WordPress and your theme print the title and viewport tags, but not a meta description.

I tested both methods below on WordPress 7.1.3, with Rank Math 1.0.280 for the plugin method and Code Snippets 4.0.0 for the no-plugin method.

Which Meta Tags Matter in WordPress

TagWhat it doesWho adds it
Title (<title>)The clickable headline in search results and the browser tabWordPress, or your SEO plugin if you set a custom one
Meta descriptionA suggested summary for the search result. Not a ranking factor, but a clear one earns clicksYour SEO plugin, or a snippet
RobotsTells search engines whether to index a pageWordPress and SEO plugins
Verification (for example google-site-verification)Proves to Google, Bing or Pinterest that you own the siteYour SEO plugin, or a snippet
Open Graph (og:)Controls the title, text and image when a page is shared on social mediaYour SEO plugin
ViewportMakes the page fit phone screensYour theme (WordPress adds it for block themes)
Meta keywordsNothing for Google, which ignores itSkip it

Method 1: Add Meta Tags With an SEO Plugin

An SEO plugin is the easiest and safest method because it handles every post, the homepage and social tags in one place. The steps below use Rank Math. Yoast SEO and All in One SEO have the same fields under slightly different names.

Step 1: Open the Post’s SEO Panel

Install and activate Rank Math from Plugins > Add Plugin, then open the post or page you want to edit. Click the Rank Math score button in the top toolbar.

Rank Math score button in the WordPress block editor toolbar
The Rank Math score button opens its SEO panel.

Step 2: Edit the Snippet

Click Edit Snippet under the search preview.

Edit Snippet button in the Rank Math General tab
Edit Snippet opens the title and description fields.

Step 3: Write the Title and Meta Description

In Title, keep the default (your post title plus site name) or write your own. In Description, write one or two sentences that tell searchers what the page gives them. Aim for roughly 120 to 160 characters and write a different description for every page. Rank Math saves the fields when you save the post.

Rank Math snippet editor with the Title, Permalink and Description fields
The snippet editor with a demo meta description and a live preview at the top.

If you’re unsure what to put in the title and description, my guide to adding keywords in WordPress shows where your main phrase should go.

Add Meta Tags to Your WordPress Homepage

The homepage often has no post editor of its own, so SEO plugins give it a separate setting. In Rank Math, go to Rank Math SEO > Titles & Meta > Homepage, change the title tag in Homepage Title if you want, fill in Homepage Meta Description and click Save Changes. Without an SEO plugin, the snippet in Method 2 below adds a homepage description for you.

Rank Math Titles and Meta Homepage settings with the homepage title and meta description
Rank Math’s Homepage settings, with the Homepage Title and Homepage Meta Description fields.

This screen applies when your homepage shows your latest posts. If you set a static page as your homepage under Settings > Reading, edit that page and use its snippet editor instead.

Add Verification Meta Tags

Google Search Console, Bing Webmaster Tools and Pinterest can verify your site with a meta tag. In Rank Math, go to Rank Math SEO > General Settings > Webmaster Tools and paste the code from the service, then save. You can paste the whole tag or just the code inside content="…".

Rank Math Webmaster Tools settings with fields for Google Search Console and Bing verification codes
Rank Math’s Webmaster Tools fields for verification codes.

Keep the tag in place after verifying. Google rechecks it from time to time, and Search Console’s help says removing it can cost you verification. If you’d rather not add a tag, Search Console also accepts an HTML file, explained in my guide to uploading an HTML file to WordPress, or a DNS record.

Method 2: Add Meta Tags Without a Plugin

If you don’t use an SEO plugin, add the tags with a snippet on the wp_head hook. I use the free Code Snippets plugin so a typo is less likely to lock me out, but a child theme’s functions.php works too. Don’t edit your theme’s header.php: block themes don’t have one, and theme updates overwrite it in classic themes.

Go to Snippets > Add New, paste this code, change the text and verification code, set Location to Only run on site front-end and click Save and Activate:

add_action( 'wp_head', function () {
	// Homepage description, or the excerpt on single posts and pages.
	if ( is_front_page() ) {
		echo '<meta name="description" content="' . esc_attr( 'Real WordPress tutorials, tested on a live lab site.' ) . '">' . "\n";
	} elseif ( is_singular() && has_excerpt() ) {
		echo '<meta name="description" content="' . esc_attr( wp_strip_all_tags( get_the_excerpt() ) ) . '">' . "\n";
	}

	// Site verification tag, for example from Google Search Console.
	echo '<meta name="google-site-verification" content="your-verification-code">' . "\n";
} );
Code Snippets Edit Snippet screen with the Add meta tags without a plugin snippet set to Only run on site front-end
The snippet in Code Snippets, set to Only run on site front-end.

On my test site, the homepage then included these two lines in its <head>:

<meta name="description" content="Real WordPress tutorials, tested on a live lab site.">
<meta name="google-site-verification" content="your-verification-code">

For posts, the snippet uses the excerpt, so write one in the Excerpt panel of the post settings sidebar. Pages don’t have an Excerpt panel by default, so apart from a static homepage they get no description from this snippet, and neither do posts without an excerpt. Google then writes its own snippet from the page.

Some themes already print the excerpt as a meta description. When I tested this snippet with the Hello Elementor theme, a post with an excerpt got two identical description tags, one from the snippet and one from the theme. View your page source first, and if your theme already adds a description for posts, delete the elseif part of the snippet. Also don’t run this snippet alongside an SEO plugin that also outputs descriptions. Two description tags on one page is a common audit error; my guide to fixing duplicate meta descriptions explains how to find and remove them.

How to Check Your Meta Tags

  1. Open the page in a private browser window, right-click and choose View Page Source.
  2. Press Ctrl+F (Cmd+F on a Mac) and search for name="description". You should find exactly one.
  3. Search for the verification name, such as google-site-verification, before you click Verify in Search Console.
  4. Clear your caching plugin or host cache if the old tags still show.

Remember that Google may still show different text from your meta description when another passage on the page matches the search better.

Where to Add Keywords in WordPress

These are the places where a keyword helps readers and search engines understand the page, and where to edit each one in WordPress:

PlaceWhere to edit itTip
SEO titleYour SEO plugin’s snippet editorPut the main phrase near the start and keep the title readable.
Post title (H1)The title field at the top of the block editorIt can match the SEO title or be a little longer.
URL slugThe Slug row in the Post tab of the settings sidebarKeep it short and set it before you publish. If you change a published post’s slug, WordPress usually redirects the old URL, but pages don’t get this, so check the old URL and add a 301 redirect if it returns a 404.
First paragraphThe opening of your contentAnswer the searcher’s question straight away, using their words.
SubheadingsHeading blocks (H2, H3)Use the phrase or a close variation in one or two headings where it fits.
Image alt textSelect the image block, then Alternative text in the Block tabDescribe the image. Include the keyword only when it truly describes it.
Meta descriptionYour SEO plugin’s snippet editorSummarize the page. Google often bolds words that match the search.
Slug row in the Post tab of the WordPress block editor settings sidebar
The slug is in the Post tab of the settings sidebar. Demo post on the How-To WP lab site, WordPress 7.1.3.
Alternative text field for a selected image block in the WordPress block editor
Select an image block, then write its alt text under Alternative text in the Block tab.

Put the phrase in each of these places once, where it reads naturally, then write the rest of the page for the reader. Repeating it more often doesn’t help, and Google treats obvious repetition as keyword stuffing.

How to Use Keywords in Your Content

  • Start from the reader’s question. Find out what people actually search for with a keyword tool, Google’s autocomplete or the queries in Search Console.
  • Use the main phrase naturally in the title, the opening paragraph and a heading or two where it fits. Use related words elsewhere.
  • Answer the question completely. A page that fully solves the problem beats a page that repeats the keyword.
  • Never force a keyword into a sentence. If it reads awkwardly, rewrite the sentence.

When you choose topics, prefer specific phrases that match a clear need, such as “change author of a WordPress post” rather than “WordPress”. Specific searches are easier to rank for and bring readers who want exactly what you wrote.

Keyword Magic Tool
Keyword Magic Tool

Keyword tools such as Semrush show estimated search volume and difficulty. Use those numbers to compare ideas, not as exact figures; every tool estimates them differently.

WordPress Tags Are Not SEO Keywords

The Tags box in the post sidebar looks like a place for keywords, but it isn’t. Tags group related posts and create an archive page for each tag, such as /tag/seo/. Adding dozens of tags creates many thin archive pages and does nothing for the post’s ranking. Use a few tags only when they help readers find related posts.

Frequently Asked Questions

Do I still need the meta keywords tag?

No. Google ignores it for ranking, so it’s wasted effort, and it shows competitors which phrases you target.

How do I add a meta tag to only one page without an SEO plugin?

In the Method 2 snippet, wrap the tag’s echo line in a condition such as if ( is_page( 'contact' ) ) { … }. is_page() accepts the page’s slug, ID or title, so the tag only prints on that page.

Where are meta tags stored in WordPress?

They aren’t stored in a file. WordPress builds the <head> each time a page loads, and plugins or snippets add their tags through the wp_head hook. SEO plugins save your titles and descriptions in the database with each post.

Do meta tags improve my rankings?

The title tag matters for rankings and clicks. The meta description doesn’t affect rankings, but a clear one can earn more clicks. For the rest of your on-page setup, see my on-page SEO guide.

Related Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our Monthly Newsletter

Get monthly updates of WordPress tips, tricks, and tutorials in your email.

Thanks. You have successfully subscribed.