How to Insert META Description Tags in WordPress

It is essential to include the META Description tag on all your webpages for better search engine indexing. But most blog platforms and client do not create such unique description tags for each article page.

WordPress too does not create such META tags. META Description tags are inserted between the HEAD tags on the webpage. So how to create meta description tags for all your webpages which are customized for each page?

You need to edit the HEADER file in your blog template presentation. Then you need to add a META description tag.

It is easy to add meta description tag based on any custom text like
<meta name="description" content="any text you want">

or you can insert the blog description within the tags.

<meta name="description" content="<?php bloginfo('description'); ?>" >

or use this tag to get a short excerpt of your post into the description.

<meta name="description" content="<?php echo htmlentities(get_the_excerpt()); ?>" > 

Now if you want to customize descriptions on specific pages like index page, single post pages, category pages or archives, you can place these codes between the conditional tags. “The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches.”

Some common conditional tags are
The Main Page
is_home()

A Single Post Page
is_single()

A PAGE Page
is_page()

A Category Page
is_category()

Any Archive Page
is_archive()

Not so complex? suppose you do not want to include the same blog description on all pages, but choose to include short post excerpts on all single post pages to make it more targeted. You get this code.

<?php if (is_single()) { ?>
<meta name="description" content="<?php echo htmlentities(get_the_excerpt()); ?>" />
<?php } ?> 

If you want a more automated means of doing the job, you can use several META tags wordpress plugins which can do this for you easily. But put those META tags in your WordPress today.

Share with friends

29
Leave a Reply

Leave a Reply

  Subscribe  
newest oldest most voted
Notify of
Ron Pemberton
Ron Pemberton

Do you use a plug-in? If so, which one? And, are meta tags completely unassociated with the tags created by plug-ins like Ultimate Tag Warrior?

There is a lot of confusing reading to be found on the subject of meta tags. I keep reading that search engines completely ignore meta tags due to their misuse by spammers over the years.

khoj4u
khoj4u

Good contents

carlo dela cruz
carlo dela cruz

I tried to submit my site to MS Live Search engine. It generates me a meta name which I need to include in the index page of my site.

How can I do this? My blog site is WordPress and in my home directory I only see index.php
How can I insert the meta name like this:

this space is contains alphanumeric characters

Thanks.

Sonia
Sonia

Thanx for this wonderfull tip….
I was looking the same.. from long time…

Oscar TG
Oscar TG

Thank you so much, I’ve spent ages trying to get this to work with various plug-ins. One line of php was all it took. Thank you!

Johny Deep
Johny Deep

This was really helpful. 10x.

aNAND
aNAND

Thanks for the code. That works :)

ashy4081
ashy4081

thx for this code hope it will work i ll try out this today

koppit
koppit

Just wanted to point this one out: if you want a description for only the landing page, you can use this code:

Chuck
Chuck

Good method to add META description tag to each script.

Thank muck.

Berry Oaklan
Berry Oaklan

Just know the easy way to seperate meta content to each page.
Thanks much,

Don
Don

Thank for code.

webmaster
webmaster

thx for this wonderful help really gr8

Dannie Tindel
Dannie Tindel

Exceptional site, where did you come up with the info in this piece of content? I’m pleased I found it though, ill be checking back soon to see what other articles you have.

oladipupo
oladipupo

pleas i need ways to insert meta tags on my site

Ngoc Thuy Shop
Ngoc Thuy Shop

Do you know how to insert meta tags for blog hosted on WordPress.COM?

Freehandyman
Freehandyman

Thanks for the helpful tips and advice! I’ll try to implement them immediately.

Denver Chiropractor
Denver Chiropractor

Very helpful article thank you very much!

barnastmalistan
barnastmalistan

thanks for info and code, it works.

benjie
benjie

thank you for this. very very helpful.

Silvani BLOG
Silvani BLOG

Thanks for sharing the tips. At last i now understand the work of meta description and meta tags plus how to impliment them.

Jackie
Jackie

People who understand WordPress code seem to get this. However, I don’t understand how, why and where to insert Meta Descriptions — nor how to check if they came through correctly. Could you help with that? Thank you!

QOT
QOT

View Source of the page in the browser, and the code will be seen between the HEAD tags.

Varinder Pal Singh
Varinder Pal Singh

Thanks for the nice tutorial.

Nisha Advani
Nisha Advani

Thanks! , though am using wordpress which has all in one seo for the description this could be useful for my non-wordpress websites!!

Zion Amal Rafeeq
Zion Amal Rafeeq

Hey Nisha.
WordPress is the Best Platform for Blogging and happy to hear that more users are bouncing into WP.
Cheers.

Pratik
Pratik

meta tags used to be more helpful, providing important information to the Internet browser. However, Google does no longer use the meta keyword and Covering all the reasons meta tags are and aren’t important to search engines though.

MineshRai
MineshRai

I use Thesis Framework, it has in-build option for this, its nice.

Zion Amal Rafeeq
Zion Amal Rafeeq

Thanks a lot for sharing :)
I’m new to WordPress and I’m pretty sure I’ll be back to QuickOnlineTips for more.