我需要更改或删除 <title>
使用插件在 wordpress 中标记
例如 <title> My old title </title>
=> <title> New title </title>
我试试
function plugin_title($content){
$content=str_replace('My old title','New title',$content);
return $content;
}
add_filter('wp_head','plugin_title');
//但它不起作用。任何的想法 ?
最佳答案
尝试使用 wp_title 钩子(Hook)
add_filter( 'wp_title', 'custom_title', 20 );
function custom_title( $title ) {
return str_replace('My old title', 'New title', $title);
}
关于php - 如何使用插件、add_filter 删除或更改 wordpress 中的 <title> 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7348004/