Subscribe:

Ads 468x60px

Membuat Rel Nofollow Pada WordPress Tanpa Plugin (Auto)

Membuat Rel Nofollow Pada WordPress Tanpa Plugin - Cara ini akan membuat semua category yang ada pada postingan kita menjadi "nofollow", termasuk juga pada breadcrumbs yang sudah sobat buat.


  1. Buka file functions.php

  2. Letakkan kode berikut pada funtions.php, terserah dimana, mau diatas boleh, dibawah boleh yang jelas diantara kode tag php yaitu <?php dan ?>

  3. Kodenya adalah sebagai berikut
    /* add rel nofollow to category */

    add_filter( 'the_category', 'crot' );

    function crot( $text ) {

    $text = str_replace('rel="category tag"', 'rel="nofollow"', $text);

    return $text;

    }

  4. Kalau sudah silahkan save

Cara Membuat Rel Nofollow Pada Widget Categories Secara Otomatis



Sebenarnyadengan kode diaatas sudah cukup untuk me-nofollow-kan semua category di wordpress (pada postingan dan breadcrumbs). Akan tetapi maasih ada yang kurang, yaitu pada widget category.



Kode diatas tidak akan membuat rel nofollow pada widget category sehinggaa kita butuh kode lain, langkah-langkahnya sama, kemudian tambahkan kode berikut ini

/* add rel nofollow to widget categories */

add_filter( 'wp_list_categories', 'cret' );
function cret( $text) {
$text = stripslashes($text);
$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
return $text;
}


Nah sekarang kita sudah bisa membuaat semua category menjadi nofollow, baik di postingan, breadcrumbs, maupun widget categories, secara keseluruhan kodenya sebagai berikut

/* add rel nofollow to category */

add_filter( 'the_category', 'crot' );

function crot( $text ) {

$text = str_replace('rel="category tag"', 'rel="nofollow"', $text);

return $text;

}



/* add rel nofollow to widget categories */

add_filter( 'wp_list_categories', 'cret' );
function cret( $text) {
$text = stripslashes($text);
$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
return $text;
}


Bagaimana? Mudah kan membuat rel nofollow secara otomatis di wordpress? Just try it and u will get better serp. Selamat mencoba :)