3 Simple Ways to Add Meta Tags in WordPress

Jigar Shah
Jigar Shah
how to add meta tags in wordpress

No matter how good your page or post is–if its snippet on Google looks generic, the impressions may not convert well to clicks. The reason behind that is likely to be missing or poorly optimized meta tags. That’s why they are among the key elements of the WordPress SEO checklist.

Meta tags are hidden HTML elements that shape how search engines and users see your content. That directly impacts the clicks and rankings. You can add meta tags in WordPress without much coding expertise—just a few simple steps.

So let’s look at how to add meta tags manually, using functions.php, and through plugins. So it begins.

What are Meta Tags?

Meta tags are HTML code snippets that provide search engines with key info about your page or post. While they don’t appear on the page itself, these tags influence how your content is displayed in search results. Plus, they can help with social media sharing and rendering of the pages on different devices.

These tags offer insights into a page’s title, description, and other attributes. They help improve how search engines like Google perceive and users interact with a website.

Types of Meta Tags

With the meta tags, search engines can understand and display your content effectively. There are different types of meta tags. While some directly impact rankings, others influence usability and visibility.

Title Tag (<title>)

The title tag in WordPress is generated based on the title you provide when creating a post or page. It is essential for on-page SEO, as it represents the title of your content in search engine results and browser tabs. You can customize the title tag using SEO plugins or themes that support SEO features.

Meta Description Tag (<meta name= “description”>)

The meta description tag allows you to specify a brief description of your post or page’s content. It is often displayed in the SERPs below the title and can influence whether users click on your link. You can customize the meta description using SEO plugins or themes.

Meta Robots Tag (<meta name= “robots”>)

The meta robots tag is crucial for instructing search engine crawlers on how to handle your web page. It can control whether a page should be indexed or not, whether links should be followed or not, and other important indexing instructions.

Open Graph Protocol Tags

These tags are used to control how your content appears when shared on social media platforms like Facebook. They include tags such as og:title, og:description, og:image, and og:url. WordPress SEO plugins often provide options to set these tags for individual posts and pages.

Canonical Tag (<link rel= “canonical”>)

The canonical tag helps address duplicate content issues by specifying the preferred URL for a particular post or page. It can be essential if you have multiple URLs containing similar content.

Here are common examples of meta tags offered by WordPress itself:

<meta name="resource-type" content="document" />
<meta http-equiv="content-type" content="text/html; charset=US-ASCII" />
<meta http-equiv="content-language" content="en-us" />
<meta name="author" content="Harriet Smith" />
<meta name="contact" content="harrietsmith@harrietsmith.us" />
<meta name= "copyright" content= "Copyright (c)1997-2004 
Harriet Smith. All Rights Reserved."/>
<meta name="description" content="Story about my dog 
giving birth to puppies."/>
<meta name= "keywords" content= "stories, tales, harriet, smith, 
harriet smith, storytelling, day, life, dog, birth, puppies, happy"/>

While meta tags are not sole determinants of a web page’s ranking and visibility, they are still incredibly valuable. So if you want that and other crucial aspects of SEO handled professionally, hire our SEO experts.
Next up, we’ll check out the different ways to add meta tags: manually, using functions.php, and using WordPress plugins.

Want a professional SEO audit and optimization for your website?

How to Add Meta Tags in WordPress Manually?

For this meta tag addition, you need to work with the header.php file located in the WordPress file structure.

Since the header file is a key part of the WordPress theme, I recommend you backup your website. So if something goes awry, you can restore the site. You can also create a child theme to make sure you don’t lose your modifications during theme updates.

Step 1: Log into your WordPress admin dashboard

Step 2: Navigate to “Appearance” and select “Theme File Editor”.

how to add meta tags in wordpress-method1-step2

Step 3: Now, from a list of theme files, locate “header.php” and open it with a text or code editor.

how to add meta tags in wordpress-method1-step3

Step 4: Inside the ‘header.php’ file, locate the ‘<head>’ section. This section typically contains the opening ‘<head>’ tag and various other meta tags and links.

Step 5: Add your custom meta tags between the <head> and </head> tags. For example, to add an Open Graph meta tag for an image, you can use the following code:

<meta property="og:image" content="https://example.com/your-image.jpg">

Replace “https://example.com/your-image.jpg” with the actual URL of your image and adjust the properties and content as needed for other meta tags.

Step 6 (Optional): Add a Conditional Meta Tag for Post Views
Want to display a unique meta description for individual posts versus archive or homepage views? You can achieve this using a simple conditional query.

First, go to Admin > Settings > General and set your site’s meta description in the Tagline field.

Next, insert the following code into your header.php file:

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

This code ensures that single-post pages show the post title as the meta description, while other pages display the site name and tagline instead.

Step 7: After adding the desired meta tags, click the “Update File” button to save your changes to the ‘header.php’ file.

how to add meta tags in wordpress-method1-step6

Now, to ensure that your custom meta tags are correctly added to your website, visit the best browser for WordPress development. Right-click on the website and select “Inspect” to view the page’s source code. There, you can confirm that the meta tags are present in the ‘<head>’ section.

If you encounter issues with this process, it would be more suitable to hire dedicated WordPress developers.

How to Add Meta Tags in WordPress Using functions.php?

Editing the functions.php file offers more granular control over meta tags without relying on plugins. It’s ideal for adding dynamic meta tags, site-wide defaults, or conditional logic. But again, make sure to take backup of your website before starting this process.

Let’s start the process of adding meta tags in WordPress using functions.php.

Step 1: Access the WordPress admin panel.

Step 2: Navigate to “Appearance” and select “Theme File Editor”.

how to add meta tags in wordpress-method1-step2

Step 3: From the file list on the right-hand side, locate and select “functions.php”.

how to add meta tags in wordpress-method2-step3

Step 4: Open the “functions.php” file with a text or code editor, and add your custom meta tags. 

function custom_dynamic_meta_description() {
    global $post;
    if ( is_singular() ) {
        $post_content = strip_tags( $post->post_content );
        $post_content = strip_shortcodes( $post_content );
        $post_content = str_replace( array("\n", "\r", "\t"), ' ', $post_content );
        $post_content = mb_substr( $post_content, 0, 300, 'utf8' );
        echo '<meta name="description" content="' . esc_attr( $post_content ) . '" />' . "\n";
    }
    if ( is_home() ) {
        echo '<meta name="description" content="' . esc_attr( get_bloginfo( "description" ) ) . '" />' . "\n";
    }
    if ( is_category() ) {
        $category_description = strip_tags( category_description() );
        echo '<meta name="description" content="' . esc_attr( $category_description ) . '" />' . "\n";
    }
}
add_action( 'wp_head', 'custom_dynamic_meta_description' );

Step 5: After adding the desired meta tags, click the “Update File” button to save your changes to the ‘functions.php’ file.

Step 6: To ensure that your custom meta tags are correctly added to your WordPress site, visit the pages where you added them.

Step 7: If using a caching plugin, make sure to clear the cache on your WordPress website to ensure that your changes take effect immediately.

As you may understand, the functions.php as well as header.php files directly impact the way your website functions. So if you don’t have the coding skills or expertise, get our professional WordPress development services.

Or you can opt for the plugin method.

How to Add Meta Tags Using WordPress Plugins?

WordPress plugins are like Swiss Army knives. With them, you can integrate a range of features and functionalities into your website effectively. That includes the ability to add meta tags without requiring any coding.

SEO plugins like Rank Math, Yoast SEO, and more help simplify adding and managing meta tags. That makes them user-friendly for WordPress users. Or you can use a dedicated plugin like Meta Tag Manager.

Option 1: Using Meta Tag Manager

Here, we’ll see how to add meta tags in WordPress using the plugin “Meta Tag Manager”.

Step 1: Log into the WordPress admin.

Step 2: Navigate to “Plugins” and click “Add New”.

Step 3: Search for “Meta Tag Manager.”, click “Install Now”, and then “Activate”.

Step 4: After activating the plugin, you’ll find a new menu item called “Meta Tag Manager” in your WordPress dashboard. Click on the WordPress plugin’s setting to configure them.

In the settings screen of this plugin, you’ll see five sections: Custom Meta Tags, General Options, Open Graph (for open graph tags), Structured Data (Schema), and Site Verification, along with “Pro Features!”.

how to add meta tags in wordpress-method3-step4

Step 5: In the “Custom Meta Tags” section, there lies an option to “Add Meta Tag”. Click on it.

That will open up a bunch of settings to add meta tags on WordPress websites.

Tag Type

The tag type specifies the purpose or category of the meta tag you’re adding. It helps you choose the right type of meta tag for your specific use case. Some common tag types include:

  • meta (Generic meta tag)
  • title (Title tag)
  • link (Link tag)
  • script (Script tag)
  • style (Style tag)
  • og (Open Graph tags for social media)
  • twitter (Twitter Card tags)
  • jsonld (JSON-LD structured data)

Name Attribute

The name attribute, also known as the property attribute for Open Graph tags, specifies the name or property associated with the meta tag. This attribute helps search engines, social media platforms, and browsers understand the purpose of the tag. For example:

  • name= “description” for the meta description tag.
  • property= “og:title” for the Open Graph title tag.
  • name= “keywords” for the meta keywords tag (though it’s not commonly used anymore).

Value Attribute

The value attribute contains the actual content or value of the meta tag. This is where you provide the specific information you want to convey through the tag. For example:

  • content= “Your meta description text here” for the meta description tag.
  • content= “Your website title” for the title tag.
  • content= “https://example.com/your-image.jpg” for the Open Graph image tag. 

These attributes work together to define the purpose and content of each meta tag you add using the “Meta Tag Manager” plugin. Plus, you have to specify “Where to display this tag”.

By specifying the tag type, name (or property), and content, you can control how your website’s information is presented to search engines, social media platforms, and other online services.

This plugin lets you add as many meta tags in your WordPress website as you want. After customizing the settings according to your requirements, click on “Save Changes”. That will add meta tags to WordPress. 

Option 2: Using Yoast SEO

Another widely-used option is Yoast SEO, a plugin that integrates directly with your post/page editor. Once installed and activated, scroll below your content editor to find the Yoast SEO meta box.

Yoast SEO meta box

Here’s what you can configure:

  • Focus Keyphrase: Enter the keyword you’re targeting; Yoast provides feedback on how well your content is optimized for it.
  • SEO Title: Customize your page’s title for search engines. Keep it under 60 characters and include the keyphrase.
  • Slug: Edit the URL slug to match the topic clearly.
  • Meta Description: Write a compelling summary (under 160 characters) that shows up in search snippets.

Yoast also shows a live Google snippet preview and gives SEO readability scores, making it a beginner-friendly yet powerful option.

Option 3: Using All in One SEO (AIO SEO)

All in One SEO (AIO SEO) offers a similar but streamlined experience. After activating the plugin, you’ll find the AIO SEO settings under each post/page editor.

AIO SEO meta box

In the AIO SEO meta box, you can configure:

  • Post Title: Your search-optimized title.
  • Meta Description: Short, targeted summary for SERPs.
  • Focus Keyword: The main keyword for your content.

And more of the details according to your needs.

AIO SEO meta box configuration

AIO SEO allows users to also set default metadata for homepage, archives, and taxonomies from its global settings. It’s particularly suited for those who prefer clean interfaces without overwhelming optimization suggestions.

Plugins handle technical SEO automatically (like canonical tags), saving you time. For most users, Rank Math offers the best balance of power and simplicity.But still if you seek custom plugins for your website, get our WordPress plugin development services.

Want help with your WordPress project?

FAQs on Adding Meta Tags in WordPress

Can I add custom meta tags to WordPress pages or posts?

Yes, you can add custom meta tags to WordPress pages or posts using plugins like Yoast SEO or by manually editing your theme’s template files. Custom meta tags allow for more precise control over metadata for specific purposes.

Are social media meta tags necessary?

Yes! Open Graph (Facebook) and Twitter Cards ensure shared links display correctly with custom titles, images, and descriptions. Most SEO plugins auto-generate them.

Can I add meta tags to specific pages or posts on WordPress?

Yes, you can add unique meta tags to individual pages or posts. SEO plugins like Yoast or Rank Math let you customize titles and descriptions per post, while manual methods require editing theme files or using the HTML editor.

Can too many meta tags hurt SEO?

Only if they’re irrelevant, duplicated, or spammy. Focus on essential tags like titles, descriptions, and canonical tags—quality matters more than quantity.

Do I need meta tags for images?

Images don’t use traditional meta tags, but adding alt text (for accessibility) and descriptive filenames helps with SEO. Plugins can auto-generate these for better indexing.

Let’s Conclude

Meta tags may seem like a small detail, but they play a crucial role in the search visibility of your WordPress site. You can choose to add them manually for greater control or rely on SEO plugins for simplicity. Optimizing your titles and descriptions improves visibility and click-through rates.

Make sure to keep your tags unique, concise, and aligned with your content. That will make it easier for search engines and users to understand your pages. Don’t forget to test your tags and refine them based on performance.

And if you need help with implementing meta tags and other technical aspects in your website, connect with our WordPress professionals today!

author
Jigar Shah is the Founder of WPWeb Infotech - a leading Web Development Company in India, USA. Being the founder of the company, he takes care of business development activities and handles the execution of the projects. He is Enthusiastic about producing quality content on challenging technical subjects.

Related Blog Posts

how to embed video in wordpress

Discover how embedding videos in WordPress can boost user engagement and SEO. This guide covers embedding methods for platforms like YouTube and Vimeo, addresses common...

how to setup contact form in wordpress

Struggling with setting up a contact form on your WordPress site? This guide will walk you through how to setup contact form in WordPress to...

how-to-install-wordpress

WordPress is a powerful, flexible platform for creating websites, blogs, and more. Installing WordPress might seem like a daunting task, especially for those with no...