I want to conditionally prefix the contents of the tag if the IP address matches the dev server. I cobbled something together, and it will output the title tag correctly, but the original title tag precedes it, and therefore is the content shown in the browser tab. Thoughts?
$host = $_SERVER['SERVER_ADDR'];
if ($host =='0.0.0.0') {
remove_action( 'wp_head', '_wp_render_title_tag', 1 );
add_action( 'wp_head', '_wp_render_title_tag_dev', 1 );
function _wp_render_title_tag_dev() {
if ( did_action( 'wp_head' ) || doing_action( 'wp_head' ) ) {
echo '<title>DEV SRV:' . wp_get_document_title() . '</title>' . "\n";
}
}
}