How to Add Meta Tags in WordPress: 3 Simple Methods

Everyone wants their websites to rank at the top of the search engine rankings, and one of the ways to do it is by adding meta tags in WordPress.

Meta tags are snippets of information embedded in the HTML code of your web pages, invisible to visitors but crucial for search engines. The SEO experts use them to convey valuable information about your website’s content, structure, and purpose. That helps search engines like Google and Bing understand your website and rank it accurately.

Since meta tags carry so much weight in website ranking, I thought of creating a dedicated guide on what these SEO elements are and how you can add them to your WordPress website.

So, let’s dive in.

What are Meta Tags?

Meta tags are essential elements of HTML code that provide valuable information about a web page’s content to search engines, web browsers, and other online services. These hidden snippets of data play a crucial role in optimizing a WordPress website for search engine visibility. Plus, they can help with social media sharing and proper rendering of the pages on different devices.

By offering insights into a page’s title, description, and other attributes, meta tags help improve how a website is perceived and interacted with in the digital landscape. They are a fundamental tool for web developers and content creators striving to enhance their online presence and user experience.

Now, there are a few different types of meta tags available for WordPress websites.

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 (<meta property=”og:title”>): 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 the sole determinants of a web page’s ranking, they are still valuable tools for optimizing your website’s visibility in search results and ensuring that search engines understand your content correctly.

What are the Benefits of Adding Meta Tags in WordPress?

Adding meta tags to your WordPress website offers several significant benefits that can positively impact your site’s performance, search engine optimization (SEO), and user experience. Here are the key advantages of incorporating meta tags in WordPress:

  • Improved Search Engine Ranking: Meta tags like the meta description and title tag, provide search engines with essential information about your web pages. When properly optimized, these tags can help your content rank higher in the SERPs, increasing your website’s visibility to potential visitors.
  • Enhanced Click-Through Rates (CTR): An enticing and relevant meta description can encourage visitors to click on your site’s link when it appears in search results. By providing a concise preview of your content, meta descriptions can attract more clicks and traffic to your site.
  • Better User Experience: Clear and informative meta tags help users understand what a website page is about before they click on it. This transparency can lead to more satisfied visitors who find the content they were looking for, reducing bounce rates and increasing user engagement.
  • Optimized Social Media Sharing: Meta tags, like Open Graph Protocol and Twitter Card tags, control how your content appears when shared on social platforms. Customizing these tags can ensure your posts and pages look appealing and informative when shared on platforms like Facebook and Twitter, potentially increasing click-throughs and engagement.
  • Preventing Duplicate Content: The canonical tag, a type of meta tag, helps address duplicate content issues by specifying the preferred URL for a page. That can be crucial for SEO, ensuring that Google and other search engines index the correct version of your content.
  • Responsive Web Design: The viewport meta tag enables you to control how your website is displayed on various devices and screen sizes, ensuring a responsive and user-friendly experience for mobile users.
  • Customization & Branding: Meta tags allow you to tailor the way your website and content are presented in search results and on social media. This customization can align your site’s appearance with your brand identity and messaging.
  • SEO Plugin Integration: WordPress offers a variety of SEO plugins, such as Yoast SEO and Rank Math, which simplify the process of adding and optimizing meta tags. These plugins provide user-friendly interfaces and guidance to help you make the most of your meta tags.
  • Analytics & Tracking: Some meta tags, like those for Google Analytics or other tracking services, enable you to monitor and gather data on user behavior and website performance.

In summary, adding meta tags in WordPress is a fundamental aspect of optimizing your website for search engines, improving user experience, and enhancing your online presence. These tags empower you to control how your content is presented across various platforms and contribute to the overall success of your WordPress site. That’s why it’s a significant part of our digital marketing services.

Now that you know the benefits of tags like meta descriptions, tags, keywords, and more, let’s move on to how to add meta tags in WordPress.

How to Add Meta Tags in WordPress?

WordPress is known for its flexibility, and it shows when you’re trying to add a meta description or tag. The platform offers multiple methods and tools to cater to users with different levels of technical expertise and requirements. There are 3 ways to add meta tags in WordPress, and we’ll see the step-by-step process for each of them.

#1. Adding Meta Tags in WordPress Manually

When we talk about manually adding the meta tags in WordPress, the process is performed using ‘header.php’, a file located in the WordPress root directory

Since you’re going to be making changes to your theme files, I recommend you create a backup of your WordPress website. So, it would be possible to restore your site in case something goes wrong. And use 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 Editor”.

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

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: After adding the desired meta tags, click the “Update File” button to save your changes to the ‘header.php’ file.

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’re using a WordPress caching plugin like W3 Total Cache or WP Super Cache, clear the WordPress cache to ensure your changes take effect immediately.

Manually editing theme files like header.php requires a basic understanding of core WordPress development. Mistakes in the code can break your website. So, if you don’t have the necessary skills and experience, I suggest you opt for our WordPress development services.

#2. Using functions.php

This step is almost similar to the first one, except for the PHP code functions and WordPress hooks used to insert the meta tags into your website.

Again, if you are going with functions.php to add meta tags in WordPress, make sure you take a backup of your website. And, of course, use a child theme for more customization, flexibility, and security in case of updates.

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 Editor”.

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

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

function add_custom_meta_tags() {
    echo '<meta name="description" content="Your meta description here">';
    echo '<meta name="keywords" content="Your meta keywords here">';
    // Add more meta tags as needed
}
add_action('wp_head', 'add_custom_meta_tags');

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.

Now, as the name suggests, ‘functions.php’ directly impacts the way your WordPress website functions. So, if you don’t have the necessary coding skills and experience, consult with dedicated WordPress experts. Or you can opt for an SEO or meta tag plugin to make the process a little easier.

#3. Adding the WordPress Meta Tags Through Plugins

Plugins are like the Swiss Army Knives that equip you with a range of skills and functionalities to tackle various tasks effectively. That includes the ability to add meta tags in WordPress websites. 

SEO plugins like Rank Math, Yoast SEO, and more help simplify adding and managing meta tags, making them user-friendly for WordPress users. Or you can use a dedicated plugin like 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 it to access this WordPress plugin’s settings.

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!”.

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. 

FAQs on How to Add 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 meta keywords tags still important in WordPress for SEO?
No, meta keywords tags are no longer considered important for SEO in WordPress. Major search engines like Google do not use them as a ranking factor. Focus on meta titles, meta descriptions, and relevant content instead.
Is it possible to add meta tags to specific pages or posts in WordPress and not to all pages?
Yes, you can add meta tags to specific pages or posts in WordPress. You have control over meta tags on a per-page or per-post basis, allowing you to customize them individually to match the content and purpose of each page or post.

Conclusion

Well-crafted meta titles, meta descriptions, and other metadata can improve your site’s search engine ranking, click-through rates, and social media sharing capabilities. The flexibility offered by WordPress, along with the wealth of plugins and tools available, ensures that you can tailor your meta tags to suit your specific goals and audience.

You have three great ways to add meta tags in WordPress:

  • Through ‘header.php’
  • Through ‘functions.php’
  • Through a WordPress plugin (Rank Math, Meta Tag Manager)

Choose any of these processes and follow the instructions to the tee to create and add meta tags to your WordPress website. And if you have any more queries on this topic or need help from our SEO experts, get in touch 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.

Leave a comment