Site logo

Archived topic

Multisite site-wide code embed

1 reply · Started by Benjamin on May 3, 2017

Viewing posts 1–2 of 2

I'd like to embed a script on every outward facing page of my multisite. All child blogs use GeneratePress, but I shudder at the thought of having to update each blog separately. What's the best way to do so? Ideally it would go in the HEAD section, but that's not mandatory.

Hmm, I'm not sure if it's possible to insert code into every single site from one source.

I guess you could create a new plugin which inserts the code into wp_head, then activate that plugin on each site?

You can create a plugin like this: https://docs.generatepress.com/article/adding-php/#create-a-plugin

And add your hook into it:

add_action( 'wp_head','tu_insert_into_wp_head' );
function tu_insert_into_wp_head() {
    ?>
    Your code in here
    <?php
}
This archived topic is closed to new replies.