Php 如何在wordpress函数中用两个字符串之间的变量替换wp post内容?

Php 如何在wordpress函数中用两个字符串之间的变量替换wp post内容?,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我想要一个wordpress函数将iframe src例如:(variablestring.html)替换为(variablestring.html),并将其替换为带有变量的wordpress帖子内容。我该怎么做呢。我需要这样的功能 function replace_content($content) { $content = str_replace('http://my1stembed.tld/', 'http://my2ndembed.tld/',$content); return $con

我想要一个wordpress函数将iframe src例如:(variablestring.html)替换为(variablestring.html),并将其替换为带有变量的wordpress帖子内容。我该怎么做呢。我需要这样的功能

function replace_content($content)
{
$content = str_replace('http://my1stembed.tld/', 'http://my2ndembed.tld/',$content);
return $content;
}
add_filter('the_content','replace_content');
上述函数只是将固定的eg:()字符串替换为()而不是替换为变量。我是wordpress的新手,不知道。非常感谢您的帮助


我不明白这个问题。你不想要variablestring?@baptiste我需要来自wp站点所有帖子的带有字符串的动态variablestring(例如域替换)。我想替换DAMAI1,TLD/嵌入/ */DOMIN 2. TLD/嵌入/ */。对不起,我的英语不好。