How to Add Meta Tags in WordPress Without Plugin

Do you want to know, how to add meta tags in WordPress without plugin? If so then this guide is for you because, in this guide, I will show you how to easily add meta tags to WordPress without a plugin.

Well, meta tags are considered to be one of the most important elements in SEO( Search Engine Optimization ) and by using best SEO practices with meta tags, you can surely rank top on search engine results. With that being said, let’s know what actually meta tags are and why they are so important.

What are Meta tags?

Meta tags are HTML elements that contain useful information about a web page. Meta tags provide information to search engine crawlers about the website or a web page. Meta tags are placed inside the <head> element in the HTML document.

They are generally used to specify the page description, character set, keywords, author of the document, viewport settings, and copyrights, etc. There are many meta tags in HTML but among them, four meta tags are very useful which are important to know about. So let’s discuss them

Meta Description Attribute / Tag:

Meta description tag describes the short summary of a web page like what a web page is about on search results, so it benefits both the users as well as search enginers crawlers to quickly get the summary of a web page content.

Note: The meta description tag was 150 characters but now google has increased its lenght to 300 characters

Meta description tag on search results

The code for meta description tag is:

<meta name="description" content="Add the description or summary of your page" />

Meta Keywords Attribute / Tag:

Meta keywords Tag provides the relevant keywords to search engines. The code for meta keyword tag is:

<meta name="keywords" content="Add your keywords here" />

Title Tag:

The title tag is the title of your web page in search engine results. The code for meta title tag is:

<title> Add title tag here. It can be 45-60 characters long</title>

Meta Robots Attribute / Tag:

The meta robots tag is used to provide instruction to search engines on how the pages should be crawled. The code for meta Robots tag is:

<meta name="robots" content="noindex or index" />

Among four of these meta tags, the Meta description tag is the most important meta tag

Importance of Meta Tags

Meta tags are considered to be very important and useful in terms of on-page SEO, as it plays important role in the ranking of a website. The better you optimize the Meta tags the higher your web page or website will rank on search engines.

Impact of Meta tags on SEO

The question arises, how do meta tags impact the SEO of a website? Well, meta tags have a great impact on the SEO of a website as they affect how your site appears in the SERPs and how many people are likely to click on your web page.

So the traffic and engagements rates of your website become high which has a great impact on the rankings and SEO of your website. As by now, you know how important meta tags are so now let’s quickly get into how to add meta tags in WordPress without plugin

You May like:

How to Unpublish WordPress Site (2 Easy Methods)

How to Link External PHP File to HTML ( 2 Easy Methods )

How to Make a Phone Number Clickable in WordPress

Add Meta Tags in WordPress Without Plugin

Meta tags can be added in WordPress using plugins as well as with code. But as you know, plugins might slow down the speed and performance of a website, so if you prefer to add meta tags in WordPress without a plugin then continue reading.

So to add them in WordPress without a plugin, follow these steps:

  1. Login to your WordPress Dashboard and go to Appearance > Theme Files
  2. In the theme files, you will see Function.php file.
  3. Open Function.php file and these code in the bottom of the file.

Add Meta Description and keyword Tag

To add meta description and keyword tag to your WordPress website, then add this code:

function add_meta_tags() {
global $post;
if ( is_single() ) {
$meta = strip_tags( $post->post_content );
$meta = strip_shortcodes( $post->post_content );
$meta = str_replace( array("\n", "\r", "\t"), ' ', $meta );
$meta = substr( $meta, 0, 300 );
$keywords = get_the_category( $post->ID );
$metakeywords = '';
foreach ( $keywords as $keyword ) {
$metakeywords .= $keyword->cat_name . ", ";
echo '
<meta name="description" content="' . $meta . '" />' . "\n";
echo '
<meta name="keywords" content="' . $metakeywords . '" />' . "\n";
add_action( 'wp_head', 'add_meta_tags' , 2 );

Now, update your theme files and the Meta tags will be added to your WordPress site.

FAQ( How to Add Meta Tags in WordPress Without Plugin )

How do I add a meta tag to my WordPress header?

To add meta tags to the WordPress website header, go to your Dashboard > Appearance > Theme files, and there in the files, you will see header.php. So add these below meta tags between the <head> tag:

<meta name="description" content="Add the description or summary of your page" />
<meta name="keywords" content="Add your keywords here" />
<meta name="author" content="Your name or author name" />
<meta name="robots" content="noindex or index" />

Are meta tags important for SEO?

Meta tags are considered to be very important for SEO because of their impact on how a web page appears on search results, so if the description meta tag is used in a well-optimized way, then on search results users will quickly know what the page is about and will likely click it. So with more traffic and engagement of users, the web page will surely rank on top.

What is the recommended method to add meta tags in WordPress?

I will recommend you to use a WordPress plugin to add meta in WordPress because to achieve best SEO practices, a dedicated SEO plugin is the best way to achieve it. So I will recommend Yoast’s WordPress SEO plugin for adding meta tags.

Final thoughts on how to Add Meta Tags in WordPress Without Plugin

Adding Meta Tags to your website is a great way to make your site SEO-friendly. In this guide, I demonstrate an easy way to add meta tags in your WordPress without plugin. I hope you will be now familiar with how to add meta tags to your website and how important they are for your website.

If you have any issues or questions regarding this topic then feel free to ask in the comments section, I will surely help you out with that. Moreover, if you want me to write on any other particular topics then contact me through the contact form.

That’s it for this topic, thanks for reading…

Hamza Afridi is a Full stack Web & WordPress developer and writer with 5+ years of experience. He is Founder of, a blog on web development, SEO, and digital marketing tutorials. He enjoys learning and sharing new technologies.

Leave a Comment