2016-11-28 132 views

回答

0

已經被在這裏找到答案:https://wordpress.stackexchange.com/questions/30873/how-to-change-404-page-title

添加以下主題functions.php文件

function theme_slug_filter_wp_title($title) { 
    if (is_404()) { 
     $title = 'ADD 404 TITLE TEXT HERE'; 
    } 
    // You can do other filtering here, or 
    // just return $title 
    return $title; 
} 
// Hook into wp_title filter hook 
add_filter('wp_title', 'theme_slug_filter_wp_title'); 
0

您可以使用篩選器掛鉤

function theme_slug_filter_wp_title($title) { 
if (is_404()) { 
    $title = 'ADD 404 TEXT HERE'; 
} 
return $title; 
} 
add_filter('wp_title', 'theme_slug_filter_wp_title'); 
+0

我可以添加這些代碼行嗎? – TowTiw