Close Menu
My SiteMy Site
  • Home
  • Reviews
  • Computers
  • How Tos
  • Travel & Lifestyle
  • Phone ROMs
  • Contact
    • Advertise
    • About Us
Facebook X (Twitter) Instagram
My SiteMy Site
  • Home
  • Reviews
  • Computers
  • How Tos
  • Travel & Lifestyle
  • Phone ROMs
  • Contact
    • Advertise
    • About Us
My SiteMy Site
Home»Web Design Tips»Wordpress»How to replace a word in multiple posts in wordpress
Wordpress

How to replace a word in multiple posts in wordpress

Oscar FrankBy Oscar Frank1 Min Read
Share
Facebook Twitter LinkedIn WhatsApp Pinterest Email

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

programming Wordpress

Related Posts

Common Mistakes Newbie Developers Make and Solutions

March 23, 2021

WordPress Blog Hosting made easy with SeekaHost Blog Hosting Control Panel

December 4, 2020

7 Best Laptops For Coders In 2025

February 28, 2020
Add A Comment
Leave A Reply Cancel Reply

Recent Posts
  • 6 Sports Apps You Must Have On Your Phone
  • Valencia Travel Guide: All You Need to Know About This Spanish Gem
  • TikTok Faces Unexpected Ban in Senegal, Sparks Global Curiosity
  • The Apple GPT & Apple’s Chatbot Mysterious Debut
  • Triller Takes on TikTok: Filing for Public Listing
Get Exclusive Tech Insights!
My Site
Facebook X (Twitter) Instagram YouTube
© 2025 Oscarmini Co. Designed by illBytes.

Type above and press Enter to search. Press Esc to cancel.