Add Custom Meta Description Tags Without WordPress Plugin

tarihinde Fourlast tarafından yüklendi

In our first title, we will create a Seo-friendly url. In our second title, we will create a special description tag. We will do advanced seo work by minimizing the plugin phase.

How to Create a WordPress Seo Friendly Link

If you are new to WordPress and have not edited the permanent link settings, the link structures on your site will be installed by default as below. It pays attention to the matching title of the keyword or content in the url structures of the Google websites.

Default Link: domain.com/2020/06/03/herhangi-bir-ornek-yazi

Seo friendly link type: domain.com/herhangi-bir-ornek-yazi

Follow the steps below. WordPress login to admin panel > Settings > Permalinks

Settings > Permalink

Adding Meta Description without Using WordPress Plugin

The description tag of websites that don’t use optimization plugin displays as a summary of the last post they shared. The meta description tag is important for search engine optimization. We will optimize it with a simple code method.

Admin Panel> View> Theme Editor > functions.php

CODE:

function meta_desc_add(){
    if( is_home() || is_front_page() ){
    $meta_des = "A Special Description For Your Website.";
    echo '<meta name="description" content="' . $meta_des . '" />'; 
        }
     }
    add_action( 'wp_head', 'meta_desc_add', 4 );
    
    function meta_single_add() {
 
     global $post;
 
    if (!is_singular()) {return; }
    elseif(!empty( $post->post_excerpt)) {
    echo "<meta name='description' content='$post->post_excerpt' />";
    } 
    else 
    { $meta = apply_filters('the_content', $post->post_content);
        $meta = strip_tags($meta);
        $meta = strip_shortcodes($meta );
        $meta = str_replace(array("\n", "\r", "\t"), ' ', $meta);
        $meta = substr($meta, 0, 160);
        echo "<meta name='description' content='$meta' />";
    } 
} 
    add_action('wp_head', 'meta_single_add');

Reminder: If you do not have the knowledge and experience, please use any plugin. This arrangement may cause distortions in your theme.

Add Custom Meta Description Tags Without WordPress Plugin” İçin 47 Yorum

  1. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but definitely you’re going to a famous
    blogger if you aren’t already 😉 Cheers!

  2. Good day! Do you use Twitter? I’d like to
    follow you if that would be ok. I’m definitely enjoying your blog
    and look forward to new updates.

  3. I every time used to read piece of writing in news papers but now
    as I am a user of internet therefore from now I am
    using net for articles or reviews, thanks to web.

  4. Appreciating the hard work you put into your blog and detailed information you provide.

    It’s nice to come across a blog every once in a while that
    isn’t the same unwanted rehashed information. Great read!
    I’ve saved your site and I’m adding your RSS feeds to
    my Google account.

  5. It is the best time to make some plans for the future and it is
    time to be happy. I have read this post and if I could I wish to
    suggest you some interesting things or suggestions. Perhaps you could write next articles
    referring to this article. I wish to read more things
    about it!

  6. Thank you for the auspicious writeup. It in truth was once
    a amusement account it. Glance complicated to far added agreeable from you!
    However, how can we keep in touch?

  7. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is
    added I get four emails with the same comment.
    Is there any way you can remove people from that service?
    Cheers!

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir