Domanda

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;
}
È stato utile?

Soluzione

The issue was not persistent between multiple installations because there were multiple themes in use. The themes were creating the title tag in different ways.

Changed plugin based solution to inserting conditional banner content (and later a contextual feedback form) in wp_footer which is working regardless of theme (so far 😉)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top