[Support request] Multisite site-wide code embed

Home Forums Support Multisite site-wide code embed

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #313512
    Benjamin

    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.

    GP Premium 1.2.96
    #313602
    Tom
    Lead Developer
    Lead Developer

    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
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.