◦ Comprehensive security
◦ 24/7 support
WordPress Guide → SEO → Meta Tags
How to add meta tags in WordPress
If you’re using WordPress, you may come across meta tags when editing or posting to your site. To break it down, meta is an underlying description while tags are customized for all types of content defined in the page’s source code. In simpler terms, meta tags help Google find your site.
When search engines index your website, they collect information from the title, headings, content, and meta tags. Search engines compare the language in each of these sections and rank the website depending on how the information matches.
WordPress doesn’t support meta tags by default, but meta tags can be added manually using theme template files or through WordPress plugins.
Get fast, reliable hosting for WordPress
Power your site with the industry’s fastest, most optimized WordPress hosting
What are WordPress meta tags?
Meta tags are HTML elements that provide information about the contents of a webpage to search engines and browsers that are then displayed in search engine results. The most important meta tags for SEO are:
- Title tag: The page title shown in search results and browser tabs
- Meta description: A brief summary of the page content that appears in search results
- Robots meta tag: Instructions telling search engines how to handle the page
While meta tags have been important historically, Google no longer uses them to determine ranking. Instead, they are now more helpful in improving click-through rates (CTR), as descriptive titles and compelling meta descriptions that accurately represent your content can encourage clicks from search results.
How to add meta tags to WordPress: 3 methods to try
Now, let’s discuss how to add meta tags to WordPress. There are two ways to add meta tags to your WordPress website. You can add meta tags manually by editing header.php or functions.php files, or you can add them with the help of WordPress meta tags plugins.
How to add meta tags in WordPress with a plugin
If you are looking for a faster and easier way to add meta tags to your WordPress website, you can use WordPress plugins. Various options are available for those who want to add meta tags with plugins. You can choose the right plugin as per your requirements. Below, we’ll walk through three plugin options for adding meta tags to WordPress.
1. Yoast SEO
You can find the Yoast SEO section under any post or page you’ve edited once you activate the Yoast SEO plugin.
Yoast includes fields like focus keyphrase, SEO title, slug, and meta description.
The focus keyphrase is the search term that you want your page to rank for. The SEO title is the page title. For better results, use your focus keyword in the page title and keep it under 60 characters. The slug is a part of your URL that describes the content of a page or post. The meta description appears under the page or post title on Google and provides information about the content.
2. All in One SEO (AIO SEO)
You can find the All in One SEO section under any post or page once you activate the plugin.
Fields such as post title, meta description, and focus keyphrase need to be filled out as per your requirements in the All in One SEO (AIO SEO) settings.
3. Meta Tag Manager
Once the Meta Tag Manager plugin is installed, you can access it at Settings > Meta Tag Manager.
You can use Meta Tag Manager to add custom meta tags for specific pages, or you can enable meta tags for specific content types like page, media, and post.
To add the Meta Description Tag for the front page, go to Settings > Meta Tag Manager > Custom Meta Tags section. Click on the Add Meta Tag button, configure the meta description tag as shown in the screenshot, and then save the changes.
If you check the source code of your front page, you can see the following meta tag has been added by the Meta Tag Manager plugin.
<meta name=”description” content=”This is a demo site” />
You can add as many meta tags for your pages as per your requirements.
To enable the meta tag builder for specific content types, such as a post, go to the Settings > Meta Tag Manager and then click on General Options. Then select the posts content type and save your changes.
Now, create a new post and you can see the meta tag builder is added to it. Please refer to the screenshot.
This way, you can use the meta tag builder for different content types.
How to add meta tags in WordPress manually
You can add meta tags to WordPress by editing header.php using the following steps.
1. Find and open the header.php file
Go to Appearance and click on “Theme File Editor.”
Click on the header.php under Theme Files to open the header.php file.
Note: You can also access and edit the header.php file from wp-content/themes/{YOUR_THEME}/header.php via FTP/SSH
2. Copying and customizing meta tags
Copy the following generic code and fill it in with the keywords you’re trying to target. Place it under the <head> tag:
<meta name=”keywords” content=”keywords related to the content of the website” />
Then, copy the following generic description meta tag and paste it under the previous line:
<meta name=”description” content=”meta description for the content of the website” />
How to add meta tags in WordPress using functions.php
You can add meta tags to WordPress by editing functions.php using the following steps.
1. Find and open the functions.php file
Go to Appearance and click on “Theme File Editor.”
Click on functions.php under Theme Files to open the functions.php file.
Note: You can also access and edit the functions.php file from wp-content/themes/{YOUR_THEME}/functions.php via FTP/SSH
2. Copying and customizing meta tags
Add the following code to the functions.php file.
function hueman_add_meta_tags() {
global $post;
if ( is_singular() ) {
$des_post = strip_tags( $post->post_content );
$des_post = strip_shortcodes( $post->post_content );
$des_post = str_replace( array("\n", "\r", "\t"), ' ', $des_post );
$des_post = mb_substr( $des_post, 0, 300, 'utf8' );
echo '<meta name="description" content="' . $des_post . '" />' . "\n";
}
if ( is_home() ) {
echo '<meta name="description" content="' . get_bloginfo( "description" ) . '" />' . "\n";
}
if ( is_category() ) {
$des_cat = strip_tags(category_description());
echo '<meta name="description" content="' . $des_cat . '" />' . "\n";
}
}
add_action( 'wp_head', 'hueman_add_meta_tags');In this article, we have added the hueman_add_meta_tags custom function, which will add meta tags to the different pages of your website. We have also used the wp_head hook to add meta tags to your pages. You can replace hueman_add_meta_tags with your own theme name.
How to test your meta tags
You can verify if your meta tags work correctly using several methods.
- View your page source code (right-click and select “View Page Source”) to check if your meta tags are present and formatted correctly.
- Use Google Search Console (GSC) to see how Google reads and displays your meta information in search results.
- Other tools include Screaming Frog SEO Spider, which can audit meta tags across your entire site, and SEOquake browser extension, which provides quick meta tag analysis for individual pages.
These tools can help identify missing meta descriptions, titles that are too long, or duplicate meta content that needs fixing.
Meta tag FAQs
Getting started with meta tags in WordPress
Adding meta tags to WordPress strengthens your site’s search presence and helps visitors understand your content before clicking. Whether you choose to add meta tags manually through theme files or use plugins, regular testing with tools like Google Search Console ensures they work effectively. Remember to keep meta descriptions under 160 characters and focus on writing compelling summaries that accurately represent your pages.
If you’re looking for scalable WordPress hosting with excellent support, consider Liquid Web’s wide range of WordPress hosting solutions with built-in performance optimization tools.
Explore hosting for WordPress options below or start a chat now to talk to an expert about your site.
Additional resources
How to build a WordPress site →
A complete beginner’s guide
5 best SEO plugins for WordPress →
Did you know that there are also other well viable options on the market as well? SEO Optimization tool Rank Math has built a huge and successful community in a short period.
How to find the best hosting for SEO →
The WP Toolkit includes many valuable features for updates and security
Amanda Valle is Global Director of Organic Search at Liquid Web and a seasoned SEO, user acquisition, digital marketing leader. She has 20+ years of experience in digital marketing, SEO, and content marketing, and holds certifications from SEMrush and Google Analytics. When she’s not driving revenue, she enjoys spending time with her girls.