How to Add Meta Descriptions to WordPress Themes Using functions.php

While working on an SEO for WordPress course recently, I was looking for a way to manually add meta descriptions to a theme from the functions.php file.

After playing around a bit, I came up with this solution:

This of course raises the bigger question of why would you want to do this instead of using a plugins like SEO by Yoast or All in One SEO.  I don’t think that you actually would :p I just wanted to demonstrate how to do it.

If you have a more elegant solution, please suggest away!

One thought on “How to Add Meta Descriptions to WordPress Themes Using functions.php

  1. Szabesz

    Hi Zac,

    Thanks for sharing it! I like it 🙂 SEO by Yoast or All in One SEO or the others are a little bit of bloatware I think and the fewer plugins we have the better too. In March the news came out that Yoast WP SEO was open to SQL injection, for example. So that is why 🙂

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s