Show WordPress Tags As Meta Tags

My WordPress based sites almost always have a collection of IF_Frontpage wordpress statements.  When I see something specific I want to be used on the most important page for SEO I just work it in the template myself.

Your homepage will always have the most SEO juice (exceptions could be possible in odd circumstances). If you want to tweak your homepage, heading tags or even elements you would use a PHP IF_Frontpage statement and then an ELSE statement if you have the default for inside pages.

So here is my ELSE statement. This is how I display wordpress post tags as META Keyword tags and my Excerpt as META Description. This is what gets used on single post pages to generate the Keyword and Description Meta tags from the wordpress tags or Codex from the single posts.

<meta name=”keywords” content=”<?php if (is_single()) { the_post(); rewind_posts(); echo strip_tags(get_the_tag_list(”,’, ‘,”)); } ?>”>
<meta name=”description” content=”<?php the_excerpt(); ?>”>   <? } ?>

In the end this is basically the same as hand entering you keywords for every post if you just think of it that way when you write your tags.

Sidenote: Most people like to block the /tags/ folder in robots.txt as it can create tons of very similar pages and create a very thin website when google crawls hundreds of pages all drawn from the same post excerpts.

Another way is to just use one or two tags per post to keep it from getting out of hand.

About author

Todd Kron

of Sellaholics is a veteran of Analytics, PPC, Display, video, UX, conversion optimization, affiliate programs, web design and web programming since 2002. My background includes affiliate sales to 6 figures, director of a web design agency, and currently the digital manager for a leading energy company located in Huntersville, NC. From search to sale 1000 different ways is my background. Sellaholics is a Google Partner Agency.

Related Articles