使用MYSQL在wordpress上更改页面内容中的特定文本或URL?

时间:2013-11-29 10:14:17

标签: php mysql wordpress

1)我的网站有85页,因为我想更改所有页面中使用的特定网址。

2)我需要更新特定帖子的更新查询,并更改该内容中的重复内容

需要替换以下网址anbomanufacturing.com/LitForm.html;

使用此网址192.185.104.157/~anbomanu/product-literature

2 个答案:

答案 0 :(得分:0)

使用REPLACE()功能:

UPDATE yourTableName
SET columnName = REPLACE(columnName , 'www.anbomanufacturing.com/LitForm.html', 
                 'http://192.185.104.157/~anbomanu/product-literature');

答案 1 :(得分:0)

尝试使用此功能,并将此代码放在functions.php文件中以替换内容中的链接:

add_filter('the_content', 'link_replacer');

function link_replacer ($content = '') {
    $pattern = "/anbomanufacturing.com/LitForm.html/";
    $replace = "192.185.104.157/~anbomanu/product-literature";

    return preg_replace( $pattern, $replace, $content );
} 

有关详细信息,请查看the_content Filter