{"id":32514,"date":"2020-11-25T08:00:11","date_gmt":"2020-11-25T16:00:11","guid":{"rendered":"https:\/\/sacramentowebdesigngroup.com\/?p=32514"},"modified":"2026-02-25T22:11:32","modified_gmt":"2026-02-26T06:11:32","slug":"how-to-add-meta-tags-in-wordpress","status":"publish","type":"post","link":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/how-to-add-meta-tags-in-wordpress\/","title":{"rendered":"How to Add Meta Tags in WordPress"},"content":{"rendered":"<div class=\"content-block-wysi\">\n<p>In this tutorial, I&#8217;ll show you how to add meta tags to your WordPress website. By default, WordPress doesn\u2019t support meta tags, but with a few easy steps you can add support for meta tags in your WordPress website.<\/p>\n<p>Meta tags are important when it comes to making your website SEO-friendly. When search engine crawlers visit your website, they fetch metadata information in the form of meta tags in addition to fetching actual content of that page. In fact, meta tags allow us to inform crawlers about the specifics of the web pages.<\/p>\n<p>There are certain keyword meta tags that don\u2019t contribute to search engine ranking of your website, although some meta tags like meta description can significantly improve search results.<\/p>\n<p>WordPress doesn\u2019t come with built-in support for meta tags, and thus, you need to do a bit of extra work if you want to take advantage of meta tags. Broadly speaking, when it comes to providing meta tags support in WordPress, there are two ways: either you need to edit the WordPress code files or you need to install a third-party plugin. In this article, we\u2019ll discuss both ways.<\/p>\n<h2>How to Add Meta Tags to WordPress Without a Plugin<\/h2>\n<p>In this section, we\u2019ll discuss how you could enable meta tags support in your WordPress website without any plugins.<\/p>\n<p>To enable meta tags support, we\u2019ll have to add a code snippet in the <strong>functions.php<\/strong> file of your active theme. If you&#8217;re using your own custom theme, you can edit the <strong>functions.php<\/strong> file directly. However, if you&#8217;re using a third-party theme like Twenty Twenty, you should create a child theme before you make any changes.<\/p>\n<p>You can <a href=\"https:\/\/code.tutsplus.com\/tutorials\/how-to-create-a-wordpress-child-theme--cms-33278\" target=\"_self\" rel=\"noopener noreferrer\">learn how to create a child theme<\/a> here:<\/p>\n<ul class=\"roundup-block__contents posts--half-width roundup-block--list\">\n<li class=\"roundup-block__content\">\n<div class=\"roundup-block__primary-category topic-code\">WordPress<\/div>\n<div class=\"roundup-block__content-title\">How to Create a WordPress Child\u00a0Theme<\/div>\n<div class=\"roundup-block__author\">Rachel McCollin<\/div>\n<\/li>\n<\/ul>\n<p>In this example, I&#8217;ll show you the code for a Twenty Twenty child theme. Go ahead and open the <strong>wp-content\/themes\/{YOUR_THEME}\/functions.php<\/strong> file and add the following snippet at the end.<\/p>\n<pre class=\"brush: php noskimlinks noskimwords\">function twentytwenty_add_meta_tags() {\n\/\/ homepage\nif (is_home()) {\necho '&lt;meta name=\"description\" content=\"' . get_bloginfo( \"description\" ) . '\" \/&gt;' . \"n\";\n}\n\/\/ single post page\nif ( is_singular() ) {\nglobal $post;\n$meta_description = strip_tags($post-&gt;post_content);\n$meta_description = strip_shortcodes($post-&gt;post_content);\n$meta_description = str_replace(array(\"n\", \"r\", \"t\"), ' ', $meta_description);\n$meta_description = substr($meta_description, 0, 160);\necho '&lt;meta name=\"description\" content=\"' . $meta_description . '\" \/&gt;' . \"n\";\n}\n\/\/ category page\nif ( is_category() ) {\n$meta_description = strip_tags(category_description());\necho '&lt;meta name=\"description\" content=\"' . $meta_description . '\" \/&gt;' . \"n\";\n}\n}\nadd_action( 'wp_head', 'twentytwenty_add_meta_tags');\n<\/pre>\n<p>In the above snippet, we\u2019ve added the <code>twentytwenty_add_meta_tags<\/code> custom function which will be used to add meta tags to the different pages of your website. We\u2019ve then used the <code>wp_head<\/code> hook to add meta tags in your pages. Of course, if you&#8217;re using a different theme, replace <code>twentytwenty_add_meta_tags<\/code> with the name of your own theme.<\/p>\n<p>As you can see, we\u2019ve implemented meta tags support for the home page, single post page and category pages. Of course, you could go ahead and modify this code as per your needs. You could add support for other types of pages similarly.<\/p>\n<p>In the next section, we\u2019ll see how you could add meta tags by using third party plugins.<\/p>\n<h2>How to Add Meta Tags With Third Party Plugins<\/h2>\n<p>In this section, we\u2019ll see how you to add meta tags to your website with the help of the <a href=\"https:\/\/wordpress.org\/plugins\/meta-tag-manager\/\" target=\"_blank\" rel=\"noopener noreferrer\">Meta Tag Manager<\/a> plugin. You can install it with from the WordPress admin sidebar with <strong>Plugins &gt; Add New<\/strong>, or you can download and install it manually to your <strong>wp-content\/plugins<\/strong> directory.<\/p>\n<p>Finally, activate the plugin in the <strong>Plugins<\/strong> section of the admin sidebar.<\/p>\n<p>Once the plugin is installed, you can access the plugin UI at <strong>Settings &gt; Meta Tag Manager<\/strong>.<\/p>\n<p>There are two ways you could use this plugin. You can add custom meta tags for specific pages or you could enable meta tags for specific content types like post, page and media. So it depends on how you would like to configure meta tags in your website.<\/p>\n<h3>How to Add the Meta Description Tag for the Front Page<\/h3>\n<p>In this section, we\u2019ll see how you could add the meta description tag only on the homepage. Head over to the <strong>Settings &gt; Meta Tag Manager &gt; Custom Meta Tags<\/strong> section, click on the <strong>+ Add Meta Tag<\/strong> button and configure the meta description tag as shown in the following screenshot.<\/p>\n<p>Click on the <strong>Save Changes<\/strong> button to save your changes.<\/p>\n<p>Go ahead and check the source code of your front page ( <strong>Ctrl + U<\/strong> in Chrome), and you will see the following meta tag added by the Meta Tag Manager plugin!<\/p>\n<pre class=\"brush: html noskimlinks noskimwords\">&lt;meta name=\"description\" content=\"Just another WordPress site\" \/&gt;\n<\/pre>\n<p>In this way, you can add as many tags as you want to add to your pages.<\/p>\n<h3>How to Enable the Meta Tag Builder for the Post Content Type<\/h3>\n<p>The other option is to enable the meta tag builder for specific content types. For example, if you want to enable the meta tag builder for the Post content type, go to the <strong>Settings &gt; Meta Tag Manager &gt; General Options<\/strong> section. Select the <strong>Posts<\/strong> content type as shown in the following screenshot and hit the <strong>Save Changes<\/strong> button to save changes.<\/p>\n<p>Now, go ahead and create a new post, and you would notice that the meta tag builder is added to it as shown in the following screenshot.<\/p>\n<p>You would use it in the same way as we discussed in the previous section. In this way, you can enable the meta tag builder for different content types,<\/p>\n<div class=\"roundup-block__author\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I&#8217;ll show you how to add meta tags to your WordPress website. By default, WordPress doesn\u2019t support meta tags, but with a few easy steps you can add support for meta tags in your WordPress website. Meta tags are important when it comes to making your website SEO-friendly. When search engine crawlers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":32516,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_breakdance_hide_in_design_set":false,"_breakdance_tags":"","footnotes":""},"categories":[16,18,19,21],"tags":[17,20,22],"class_list":["post-32514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-content-curation","category-reputation-management","category-search-engine-optimization","category-wordpress-design","tag-html","tag-wordpress","tag-wordpress-plugins"],"_links":{"self":[{"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/posts\/32514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/comments?post=32514"}],"version-history":[{"count":1,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/posts\/32514\/revisions"}],"predecessor-version":[{"id":72262,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/posts\/32514\/revisions\/72262"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/media?parent=32514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/categories?post=32514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sacramentowebdesigngroup.com\/sacweb\/wp-json\/wp\/v2\/tags?post=32514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}