SEO Post no383

Read Our SEO POST:

How to Add Meta Tags in WordPress Without Plugin, for SEO purposes (Meta Description)

Learn how to SEO your Website!

Tips & Tricks about Content, Local or Technical SEO optimization for every website

Don't miss it! Read my WordPress SEO post and discover tips & trics on "How to optimize my website". Specific code optimization techniques for Pagespeed or GTmetrix reports, to speed up your WordPress and help you reach the top organic rankinks, at the first page of Google results.

Photo of post: How to Add Meta Tags in WordPress Without Plugin, for SEO purposes (Meta Description)

How to Add Meta Tags in WordPress Without Plugin, for SEO purposes (Meta Description)

Meta tags are one of the most important things in SEO. Having them on your page’s <head> section (For WordPress it is inside headers.php file), with the right content, following SEO instructions, will help you to have a better ranking on search engines result pages (SERPs).

On this SEO blog post, you can read some valuable information about meta tags. You can customize them to better describe each page, drawing in new users and making your search results stand out from competing websites. My purpose is to show you, how to add description meta tags to your WordPress website without plugins. Without one, you could be losing clicks. Especially, if you are trying WordPress theme development for the first time!

What Are Meta Tags?

Meta tags provide concise information about a website or post to search engines. They are lines of code which list info about the web page or post, such as the author, keywords, description, type of document, copyrights, and other core information. Normally, this data should be relevant to your page.

But the most important meta tag is the meta description tag. This info will be shown on the search engine result pages, right after your page title. A well-written meta description can be used to attract the reader. It is literally a bite for Click Through Rate (CTR) Manipulation tactics, which can positively impact a page’s ability to rank.

Even though Google announced in September 2009 that neither meta descriptions nor meta keywords factor into Google’s ranking algorithms for web search, meta descriptions can however impact a page’s CTR (click-through-rate).

This is an example of a meta description tag:

<meta name="description" content="This is a short description about the article or post." />

Meta descriptions can be any length, but Google generally truncates snippets to around 155-160 characters. It’s best to keep meta descriptions long enough that they’re sufficiently descriptive. I recommend writing descriptions between 50–160 characters. Keep in mind that the “optimal” length will vary, depending on the situation. But your primary goal should always satisfy the user intent, providing value and driving clicks to your website, based on the content shown to the reader.

Why are meta tags necessary for SEO?

They are really important, and you must include at least one during your on-page SEO process. The better you optimize it, the higher the number of clicks towards your website. If you do not include a meta description in your <head> section, search engines like Google, will pick some text based on your content, which might not be the ideal for your SEO strategy.

A meta description is used to draw reader’s eyes to a website from the SERP, and thus is a visible and important part of search marketing. Crafting a readable, compelling description using important keywords can improve the click-through rate for a given webpage.

Also, Search bots tend to search for necessary information for users, based on the meta tags and the content of an article. The page or post will rank higher in search result pages, if you include important keywords in metas, like title and description. For SEO purposes try putting the keyword at the beginning of a meta description and use call-to-action words in its context.

How to add meta tags in WordPress website without plugin

There are various WordPress plugins which can create meta tags for page or post as well. However, it may cause your WordPress website to be slow loading. If so, try using fewer plugins on the site.

Anyway, adding tags like meta description can be done without a plugin. You can follow some simple steps mentioned below.

Step 1: Go to wp-content/themes folder, and browse the theme folder which is currently in use.

Step 2: Find and open the file named functions.php.

Step 3: Add the following code to the functions.php file.

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

Step 4: Update the functions.php file in your theme by saving it.

If you need to add meta keyword tag, add the code below to the functions.php file. Please note that the meta keyword tag is deprecated. Normally, search engines do not use it. So use it carefully.

function seomywebsite_meta_tags() {
    echo '<meta name="meta_name" content="meta_value" />';
add_action('wp_head', 'seomywebsite_meta_tags');

Please note, you should add the above lines of code, before closing the PHP tags  ?>

Additionally, if you plan to choose a new theme, please repeat the same steps infunctions.php of your new theme.

That’s it, you just finished adding meta tags to your WordPress website without plugins.

As you see, the process involves a little bit of custom coding. I highly recommended using code, but you can also use any lightweight and automated SEO plugin for WordPress. You just need to install, activate it and fill in the appropriate data fields. To learn about how to optimize your WordPress site with any SEO plugin, refer to its own online documentation.

Another Quick example (which I have used)

If for any reason, you discover that your posts using single.php don’t have meta descriptions, add the following code at the top of your headers.php file. This is a small snippet of code, just to test the appearance of meta description, when using web crawlers for website audits.

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

What is the use of crawler?

A crawler is a program used by search engines or SEO specialists. Its purpose is to collect data from the internet. When a crawler visits a website, it picks over the entire website’s content (i.e. the text) and stores it in a data bank. It also stores all the external and internal links to the website.

Image by pch.vector from

Related tags:
Back to SEO Blog

May 2024
This website is releted to the term: Search Engine Optimizion (SEO), or otherwise known as Digital Marketing, in English (USA, Great Britain, Ireland, Australia) or Greek!

Photo credit Image by Pixabay

Guest Posting on: Digital Marketing, from SEO experts...

... Any published article or post on SEO is valid. You can follow any posted recommendations to fix your code in order to get a better score on GTmetrix or PageSpeed Insights. Whenever I find time, I continue developing my website.

Also, if you have a new SEO technique or want to publish a fantastic new SEO strategy online that converts into leads or sales, especially in the e-commerce space, please contact me and I will host your (strictly relative) article, with all proper credits to the author, for at least one month.

Moreover, I will be especially happy if I receive from you an email related to search engine optimization in Greek, which is my native language. Of course, I can provide you with any help you need and it concerns SEO in Greek or creating websites, since I have developed the Wordpress theme that you literally read from scratch. If you are an SEO specialist in Greece, share your opinion with me! So do not hesitate to contact me, I am waiting for you for any advice, question or suggestion to improve my site or anything related to SEO in Greece.

My message in Greek
Θα χαρώ ιδιαιτέρως, αν λάβω από εσάς email σχετικό με search engine optimization στα Ελληνικά, τα οποία αποτελούν τη μητρική μου Γλώσσα. Φυσικά, μπορώ να σας παράξω οποιαδήποτε βοήθεια χρειαστείτε και αφορά SEO στα Ελληνικά ή δημιουργία ιστοσελίδων, μιας και έχω αναπτύξει το Wordpress theme που διαβάζετε κυριολεκτικά από το μηδέν. Αν είστε SEO specialists στην Ελλάδα, μοιραστείτε την άποψή σας μαζί μου! Μην διστάσετε, λοιπόν, να επικοινωνήσετε, σας περιμένω για οποιαδήποτε συμβουλή, απορία ή πρόταση για βελτίωση του site μου ή οτιδήποτε σχετικά με SEO στην Ελλάδα.

SEO Implementations on Websites that I helped to get a better Google Ranking

These are a few websites on which I performed SEO (Search Engine Optimization) and of course, they now get traffic from the first page of Google results.