我有一个名为“5 Fragen an ... xyz”的字符串(wordpress 标题),在删除 HTML 标签后,该标题中的点应该被删除/替换。我除了字符串仅显示“xyz”
<?php
$wptitle = get_the_title($post->id); // getwordpress title
$wptitle = strip_tags($wptitle); // remove a <br> tag
$wptitle = preg_replace('/\.(?=.*\.)/', ' ', $wptitle); // want to remove the dots
$wptitle = str_replace('5 Fragen an', '', $wptitle); // remove the part 5 Fragen an
echo $wptitle
?>
Run Code Online (Sandbox Code Playgroud)