How to Add Meta Tags in WordPress (4 Methods — With & Without Plugin)

adding meta tags

Meta tags tell search engines what your page is about — and the right ones (title, description, robots) directly affect your click-through rate and rankings. The wrong way to handle them in WordPress is editing theme files directly. Let me show you the right way.

I’ll cover two paths: using an SEO plugin (recommended for most users), and doing it without any plugin using a safe code snippet. If you’re just starting out with WordPress, our WordPress tutorial for beginners covers the broader setup before diving into SEO.

Quick Answer: Install Rank Math or Yoast SEO. Open any post, scroll to the SEO panel at the bottom, and fill in the meta title and description fields. That’s it — no coding needed. For the no-plugin approach, add a wp_head snippet via WPCode.


Which Meta Tags Actually Matter in WordPress?

Before adding anything, know what’s worth your time in 2026:

  • Meta title — The clickable headline in search results. Most important for CTR and rankings.
  • Meta description — The snippet below the title. Doesn’t directly affect rankings, but a good one increases clicks.
  • Robots meta — Controls indexing (noindex, nofollow). Important for pages you want excluded from Google.
  • Open Graph tags — Controls how your page looks when shared on Facebook, LinkedIn, etc.

Meta keywords are dead. Google hasn’t used the keywords meta tag since 2009. Don’t waste time on it.


Method 1: Add Meta Tags With Rank Math SEO (Recommended)

Rank Math SEO plugin page on WordPress.org showing 2 million active installations, 5-star rating, and plugin description for adding meta tags in WordPress
Rank Math SEO — the plugin I use on TheGuideX for handling all meta tags, schema markup, and SEO settings.

Rank Math is what I use on TheGuideX. It has 2M+ active installations and handles every meta tag type — title, description, robots, OG, Twitter cards — all from a clean panel inside the post editor. It’s consistently one of the top picks in any essential WordPress plugins list.

Step 1 — Install and activate Rank Math:

  1. Go to Plugins → Add New
  2. Search for “Rank Math SEO”
  3. Install and activate it
  4. Run the setup wizard — it auto-detects your site type and configures sensible defaults

Step 2 — Set meta tags per post:

  1. Open any post or page in the editor
  2. Scroll down to the Rank Math SEO panel (or click the Rank Math icon in the top toolbar)
  3. Under the Edit Snippet tab, set your SEO Title and Meta Description
  4. Switch to the Advanced tab to set noindex / nofollow robots directives per page
  5. Update or publish the post

Rank Math also automatically generates Open Graph and Twitter Card meta tags from your title, description, and featured image — no extra configuration needed.


Method 2: Add Meta Tags With Yoast SEO

Yoast SEO plugin page on WordPress.org showing 10 million active installations and plugin features for meta tag management in WordPress
Yoast SEO — the most popular WordPress SEO plugin with 10M+ active installations.

Yoast SEO is the oldest WordPress SEO plugin (10M+ active installations). The workflow is nearly identical to Rank Math.

  1. Install and activate Yoast SEO from the plugins directory
  2. Open a post — the Yoast panel appears below the editor
  3. Click Edit snippet and fill in the SEO title and meta description
  4. Use the Advanced tab to set robots meta (noindex, nofollow, canonical URL)
  5. Save the post

Rank Math vs Yoast: both work well. Rank Math offers more features on the free plan (schema markup, redirect manager, keyword ranking). I’ve compared them in detail in my Rank Math vs Slim SEO comparison — worth reading if you want a lightweight alternative. Yoast is more established and has a larger support community. Either one is a solid choice.


Method 3: Add Meta Tags Without a Plugin (Using WPCode)

WPCode (Insert Headers and Footers) plugin page on WordPress.org — a lightweight code snippet manager for adding meta tags without editing theme files
WPCode — the safest way to add custom meta tag snippets in WordPress without touching theme files.

If you don’t want an SEO plugin, the safest way to add meta tags is through the WPCode plugin — a lightweight code snippet manager. It’s safer than editing functions.php directly because it won’t break your site if you make a syntax error, and your snippets survive theme changes.

Step 1 — Install WPCode: Go to Plugins → Add New, search for “WPCode”, install and activate it.

Step 2 — Add the meta description snippet:

  1. Go to Code Snippets → Add Snippet
  2. Choose PHP Snippet
  3. Paste this code:
function custom_meta_description() {
    if ( is_singular() ) {
        $description = wp_strip_all_tags( get_the_excerpt() );
        if ( $description ) {
            echo '<meta name="description" content="' . esc_attr( $description ) . '">' . "\n";
        }
    } elseif ( is_home() || is_front_page() ) {
        echo '<meta name="description" content="' . esc_attr( get_bloginfo( 'description' ) ) . '">' . "\n";
    }
}
add_action( 'wp_head', 'custom_meta_description' );
  1. Set the location to Run Everywhere and the hook to wp_head
  2. Toggle the snippet active and save

This pulls the post’s excerpt and outputs it as the meta description. For it to work, make sure you’re filling in the Excerpt field on each post (found in the post editor sidebar under the “Post” tab).

Important: The WordPress excerpt itself is NOT your meta description — it’s just a summary used in archives and RSS feeds. It only becomes a meta description when a plugin or snippet maps it to the <meta name="description"> tag in the <head>. Without that mapping, the excerpt does nothing for SEO.


Method 4: Edit functions.php Directly (Advanced Users Only)

WordPress developer documentation for the wp_head action hook used to output custom meta tags in the HTML head section
The wp_head hook in WordPress — where custom meta tag snippets get injected into your page’s HTML head.

If you’re on a child theme and comfortable with PHP, you can add the same code directly to your child theme’s functions.php:

  1. Go to Appearance → Theme File Editor
  2. Select your child theme’s functions.php (not the parent theme)
  3. Add the snippet from Method 3 at the bottom of the file
  4. Click Update File

Warning: Only do this in a child theme. If you edit the parent theme’s functions.php, your changes will be wiped the next time the theme updates. And always have a recent backup before editing any theme file.


Frequently Asked Questions

Does WordPress add meta tags automatically?

WordPress adds a basic <title> tag automatically, but it does not add a meta description by default. You need either an SEO plugin or a custom snippet to output <meta name="description"> in your page’s <head>.

Should I use meta keywords in WordPress?

No. Google officially stopped using the keywords meta tag in 2009. Bing ignores it too. Adding meta keywords wastes your time and adds no SEO value. Focus on your meta title and description instead.

Can I add different meta tags for each page?

Yes — and you should. Every post and page should have a unique meta title and description written for that specific page’s keyword. Both Rank Math and Yoast let you set these individually per post. The code snippet in Method 3 also works per-page since it pulls from each post’s individual excerpt.

What’s the ideal meta description length?

Keep it between 120–160 characters. Google truncates descriptions longer than ~160 characters in search results. Write it as a reason to click — include your target keyword naturally and describe exactly what the user will get from the page.

What is a robots meta tag and when should I use it?

A robots meta tag tells search engines whether to index a page and follow its links. Use noindex on pages you don’t want in Google’s results — thank-you pages, login pages, duplicate content. Both Rank Math and Yoast let you set this per post. For pages you want to remove entirely, pair this with redirecting the WordPress page to a relevant URL.


Summing Up!

For 99% of WordPress users, the answer is simple: install Rank Math or Yoast, fill in the SEO title and description for each post, and you’re done. The plugin handles every meta tag type — including Open Graph and Twitter Cards — automatically.

If you need the no-plugin route, use WPCode with the wp_head snippet from Method 3. It’s safer than editing theme files and survives theme switches.

Got questions about a specific meta tag or a scenario not covered above? Drop it in the comments.

Happy blogging!

Sunny Kumar
Sunny Kumar is the founder of TheGuideX. He writes about SEO, WordPress, cloud computing, and blogging — sharing hands-on experience and honest reviews.