WordPress batch change domain names in articles

This tutorial is packaged and replaced for my entire site,But it can also be used to change the domain name path when you move.

such as Original domain name a.com Replace in bulk b.com

Whole station packing

download

2GB

Start of the tutorial

Entry path: themes/theme/functions.php

Add the following code

 

function replace_text_wps($text){
$replace = array(
‘https://Old domain name’ => ‘https://New domain name’,
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter(‘the_content’, ‘replace_text_wps’);
add_filter(‘the_excerpt’, ‘replace_text_wps’);

Can

end

Related Article
How to prevent articles with duplicate titles from being published?

Prevent publication of articles with the same title  I usually post articles for external links or something,The webmasters are busy,Sometimes Read more

Manually open WordPress site maintenance mode

In an updater or plug-in,WordPressThe front end will show that it is in maintenance mode,If you want to temporarily enable Read more

WordPress gets the subcategory of the current category

In productionWordPressWhen the theme is often met, how to be inWordPressThe category page displays the subcategories under the current category Read more

The method of forbidding the automatic saving of WordPress articles

Before, Xiao Bian talked about it《solveWordPressarticleidA simple method of discontinuity》Mentioned inWordPress自动保存article的时间间隔的问题,And today we are talking about direct prohibitionWordPressarticle自动保存的方法,The method is Read more

Leave a Reply

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

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image