标签: wordpress woocommerce preg-replace add-filter
如何在function.php中查找和替换字符串并将匹配的字符串转换为数字或货币
内容:“
我要替换为:“
但是下面的代码我得到:“
function replace_myprice($content) { $content = preg_replace('/\[myprice=([0-9^[]*)\]/', '\$ $1', $content); return $content; } add_filter('the_content','replace_myprice');