How To Add Meta Tags to WordPress Easily Without Plugins

How To Add Meta Tags to WordPress Easily Without Plugins

Meta tags are an essential part of website SEO. Yet, many WordPress users must know the value of adding meta tags to their posts. Adding meta tags to your website can help modern search engine crawlers better understand the content of your pages, allowing for better visibility in search engine rankings. Unfortunately, many WordPress users must become more familiar with manually adding meta tags. They need to be aware of the various tools and plugins available to help.

This blog post will provide an in-depth guide to adding meta tags to WordPress without using a plugin. I will share the steps you can take to manually add meta tags to your pages and posts and a few helpful tips to make the process easier. Additionally, I will go over the advantages and disadvantages of using plugins to add meta tags. This guide lets you better understand how to optimize your WordPress website with meta tags, enabling you to reach more potential visitors.


What Are Meta Tags

Meta tags are HTML tags that provide essential information about your website. They are used to describe each page on a website and help search engine crawlers understand the content and relevancy of each page. It allows for proper indexing of the page, increasing the likelihood that it will appear on relevant results pages in search engines.

Meta tags are influential when it comes to SEO. Search engines use meta tags and other signals, such as a website’s content, to rank pages on their search results pages. Therefore, properly optimizing your site using meta tags will enable you to rank higher in search engine results pages.

Meta Tags


Why Are Meta Tags Crucial for SEO?

Meta tags are crucial in ranking your WordPress website in search engine results pages. Meta tags are used to indicate the content of each page, which is then used by search engine crawlers to determine what each page is about and how it should be categorized. Based on meta tag information and additional signals, search engines rank websites accordingly.

In short, meta tags are the first thing that both search engines and potential visitors will read about your website. Including essential information in your meta tags will help search engines better understand your pages or contents, leading to higher rankings in search engine results pages.

Meta Tags For SEO


3 Types of Meta Tags

There are three different types of meta tags you’ll want to add for each page of your website. Each is important for conveying further information about the content and its relevance on your site.


Meta Title

The meta title is used to describe your page to the search engines. These titles typically contain 60 characters, and the search engines use them to determine how an article is categorized at the top of search results pages. It’s important that your meta titles accurately portray what each page on your site is about, so you should focus on making sure they communicate what you’re trying to say concisely.

meta title


Meta Description

This tag describes a web page in a brief, well-written sentence. It usually contains 150-160 characters, which you can view in the search engine results pages under the website’s title. The meta description helps users decide whether to click on that result. This tag also serves as an important ranking signal for search engines, so it’s vital that the meta description accurately portrays what the page is about.

meta description


Robots

This tag tells search engines and web crawlers how to interact with the content of your website. With this tag, you can tell them whether they should index or follow a page, as well as which pages they should not crawl. This tag is also used to prevent bots from consuming too much of a website’s bandwidth by telling them that the page is too large or it’s not accessible by their robot.

robots.txt


How to Add Meta Title Without Plugin on WP

Adding meta titles on WordPress can be challenging without using a plugin. I will share a solution to add this vital tag to each page of your website.

The simplest way would be to modify your header.php file in WordPress, but I recommend using a child theme or having a backup file if you want to test it out.

Replace

<title><?php wp_title(''); ?></title>

With

<title>Your Site Name</title>

Please note that I do not recommend changing your titles to be the same on each page. Because having a unique title on each page is suitable not just for search engines but also for its usability.

header.php


How to Add Meta Description Without Plugin

You can do it in many ways when adding meta descriptions on WordPress. Still, the easiest and most recommended one is to use a plugin. But you don’t have a plugin. You can manually add the meta descriptions to your pages by following the steps below.

Step 1: Appearance & Theme Editor

First, go to the WordPress dashboard, find the appearance tab, and open the theme file editor.

theme file editor


Step 2: Functions.php

After you open the theme file editor, locate the functions.php on the right side of the pane. Then, click or open the theme function or (functions.php) file. It will open the function PHP code file.

functions.php


Step 3: Copy The Code

After you open the function PHP code file, you have to copy the code below.

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


Step 4: Paste The Code in The Function PHP Code File

After copying the code, you have to paste the code into the function.php file.
Scroll down the function.php file and paste the code at the bottom where the code line ends.

Then click on the update file button to save.

If you have completed the steps above, it should help you show the meta description from the beginning of the page or blog post. It will automatically collect the first 160 characters of the paragraph.

update functions.php


How to Add Robot.txt Without Plugin

Unfortunately, there is nothing WordPress built to add or edit the robot.txt file for you. Currently, I recommend using a plugin if you want to add or edit the robot.txt. However, WordPress will automatically create the robot.txt for you.

Robot.txt is a text file intended to tell search engines, such as Google and Bing, that a web page or entire site is not allowed to be indexed by them. You don’t have to worry about the Robots.txt file, as all new WordPress sites will have one created for you and automatically updated.


Pros & Cons of Using Plugin

WordPress Plugins are great for a lot of things, and there are hundreds to choose from. You can use plugins for SEO, security, email marketing, and more. Using plugins is a huge benefit because they allow you to add extra features to your website without changing any code. However, it does have its downsides.

Let’s look further at the pros and cons of using plugins.


Pros

• Plugins offer flexibility: Plugins allow you to add things and features to your website that you may not be able to code yourself. Most of the plugins are specifically designed to help your SEO.

• Saves a lot of time: You don’t have to learn any coding language or program to use a plugin. You don’t have to worry about modifying your code, as you can make modifications without even notifying the changes in your code.

• Easy to use: Plugins are easy to use, so you don’t have to worry about using them. To use a plugin, all you need is to find the appropriate plugin and then look for it in your WordPress dashboard.


Cons

• Plugins can leave your website vulnerable: Many shady developers put malware in their plugins without knowing their users. If you download anything, it’s always good to check the reviews on the specific plugin and pay attention to the ratings.

• Plugins conflict with each other: Plugins that perform the same function can often conflict. If they are not coded correctly, they could cause the entire website to break down.

• They can slow down page speed: Some plugins can slow down your website’s speed and affect your website’s performance. It’s best to choose plugins that are lightweight or, better yet, not to use too many plugins.

WordPress Plugins


Final Thoughts

WordPress is one of the most accessible and popular website-building platforms in the world. It is highly recommended to use WordPress. If you plan to start a website, I recommend using WordPress.

If you ever need help with SEO or web design, you can always count on SpringHive; we can help you with your web design project at a reasonable price. With a team of expert digital marketers and web developers, we can help you get your website to the top.

Related Posts
Leave a Reply

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