Let’s say you had a blog under Blogger, then after some time in the blogosphere, you decided to move to wordpress.

One thing about this is that, after Moving from blogger to WordPress, you must have purchased a domain name, and most of the post you made earlier while in blogger would still retain the word of the old domain name in the post, this trick would help you replace a particular that appears in posts with another.

Here is how to go about this in wordpress

– Edit the function.php file of your current theme and paste the code below directly at the very last line and save.

function replace_text_wps($text){
$replace = array(
// 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS'
'wordpress' => '<a href="#">wordpress</a>',
'excerpt' => '<a href="#">excerpt</a>',
'function' => '<a href="#">function</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}

add_filter('the_content', 'replace_text_wps');
add_filter('the_excerpt', 'replace_text_wps');

I hope you understand this code. Simply type in the WORD TO REPLACE and REPLACE WORD WITH THIS as shown in the code above.

Hit the share buttons if this post was helpful

LEAVE A REPLY

Please enter your comment!
Please enter your name here