How to Add Meta Tags in WordPress?

Method 1: Using the Yoast SEO Plugin

The Yoast SEO plugin offers built-in support for description and keyword meta tags:

This has made it one of the most common methods for adding meta tags to WordPress. Let’s take a look at how that process works.

Step 1: Install the Yoast SEO Plugin

To start adding meta tags to your content, you’ll first need to download the Yoast SEO plugin. You can find it by searching for “Yoast SEO” in your dashboard under the Plugins page.

The plugin will need to be activated after it has been installed. There’s both a free and a premium version, but the free version will be sufficient for adding meta tags.

Step 2: Add Meta Data to Your Posts and Pages

Once the plugin has been activated, navigate to Pages > All or Posts > All, depending on the type of content you want to add meta tags to. Click on Edit, and then scroll to the bottom of the screen where the Yoast SEO section is located:

Enter your primary keyword into the Focus Keyphrase section. Then, click on the Edit Snippet button to enter your meta description. This will be displayed in search engines, and should be a short paragraph describing the page’s content and encouraging browsers to click through.

Step 3: Save or Publish the Post or Page

Before moving on, it’s a good idea to read over your meta tags and description. Do they summarize the content of the page accurately, and are they unique and compelling?

Once you are happy with your meta tags, save the post or page, or publish it if you haven’t already. That’s all you have to do!

Method 2: Without a Plugin

While Yoast SEO is the most common and simplest way to add meta tags to WordPress, it can also be done without a plugin. Manually adding the necessary HTML tags to your header.php file is simple, but the tags will not be retained if you change your website’s theme. These meta tags will also apply to the entire website, and will not be unique to each post or page.

Step 1: Open the header.php File

To add meta tags in WordPress without a plugin, you’ll need to open the header.php file. This can be opened using File Manager or a Secure File Transfer Protocol (SFTP) client:

Once the file is open, you’ll need to look for the <head> tag. Your meta data should be placed within those tags.

Step 2: Copy and Customize the Meta Tags

Next, copy the generic keyword meta tag below and paste it under the opening <head> tag:

<meta name="keywords" content="keywords related to the content of the website" />

Then copy the generic description meta tag below, and paste it under the previous line:

<meta name="description" content="meta description for the content of the website" />

After that, you can replace the placeholders and fill in your own keywords and meta description. Both should be optimized for the content of your website as a whole.

Step 3 (Optional): Use a Conditional Tag Query

If you want a different description for single-post views and multiple-post views, you can do that too. First, navigate to Admin > Options > General, and enter your meta description into the Tagline section.

Then, the conditional tag query below can be added to your header.php file: 

<meta name="description" content="<?php if ( is_single() ) {
        single_post_title('', true); 
    } else {
        bloginfo('name'); echo " - "; bloginfo('description');
    }
    ?>" />

The conditional tag query will show the post’s title in a single-post view. Alternately, the blog name and description will be shown in multiple-post views. 

  • Was this reply helpful?
  • Yes
  • No