I am trying to append "DEV SRV:" to the page title (i.e. title tag) if the IP Address matches that of the dev server. I have tried this both in the functions.php file of my child theme and as a standalone plugin
add_filter('wp_title', 'dev_srv_title');
function dev_srv_title($title) {
$host = $_SERVER['SERVER_ADDR'];
if ($host =='0.0.0.0') {
return 'DEV SRV: '.$title;
}
return $title;
}
$_SERVER['SERVER_ADDR']
actually has the correct value (so your if gets triggered) or if the hook is not called at all? How is the title rendered in the theme? Are you using a SEO plugin?