如果您查看文档str_replace
你会找到你的需要。https://www.php.net/manual/en/function.str-replace.php
这里有3种选择:
function replace_text_wps($text){
$replace = array(
\'https://www.facebook.com/something">\' => \'https://www.instagram.com/something">\',
);
$text = str_replace(array_keys($replace), array_values($replace), $text);
// OR
$text = str_replace(array(
\'https://www.facebook.com/something">\'
), array(
\'https://www.instagram.com/something">\'
), $text);
// OR
$text = str_replace(\'https://www.facebook.com/something">\', \'https://www.instagram.com/something">\', $text);
return $text;
}
add_filter(\'the_content\', \'replace_text_wps\',99, 1);