Add Meta Descriptions Without Plugin

Hello learners, How are You? If you want to avoid plugin to add meta descriptions of your WordPress site, You are in right place. In this web developers resources we will Try to inform you “How to add meta descriptions without plugin” We don’t need no stinkin’ plugin for custom meta descriptions. All you need a custom field named “metadescription” with the desired meta description for each post.

Meta Descriptions

Once you have that going, include the following function to your theme’s header.php file (within the <head> section:

<meta name="description" content="
<?php if ((is_home()) || (is_front_page())) {
 echo ('Your main description goes here');
} elseif(is_category()) {
 echo category_description();
} elseif(is_tag()) {
 echo 'Tag archive page for this blog - ' . single_tag_title();
} elseif(is_month()) {
 echo 'Archive page for this blog - ' . the_time('F, Y');
} else {
 echo get_post_meta($post->ID, 'metadescription', true);
} ?>" />

This function enables you to customize the descriptions for various types of pages, such as the home page, category pages, tag archives, and so on. For single post-view pages, this function will display the value of the metadescription custom field.

Save

Masum Billah has written 326 articles

Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer. You may join with us to help other who want to learn web design and development. Thank you for stay with.

Recommended Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>