Global JavaScript Website Development Agency Tag

How to Load a Global JavaScript File on Every WordPress Page Without Using Themes or Regular Plugins

How to add the agency tag to client website backend?

This is something I have seen many digital marketing and Web design companies use where the client doesn’t want the agency tag to be displayed on the frontend of their website.

You can load a custom JavaScript file across all WordPress pages, without depending on the theme or exposing a visible plugin, the cleanest method is using a Must-Use (MU) Plugin.

Here’s how to do it using WordPress-native functions that are safe, stable, and invisible to normal plugin listings.

Why MU Plugins?

  • They run automatically, without activation
  • They cannot be deactivated from wp-admin
  • They’re perfect for global code injections (diagnostics, tracking, utilities)

Step-by-Step Setup

Create the Required Files

Inside /wp-content/mu-plugins/, place the following two files:

A. wp-core-init.php (Main Plugin File)

Paste this code inside:

<?php
/*
Plugin Name: WP Core Init
Description: Initializes core system hooks and output handlers.
Version: 1.0
*/

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

function wpci_enqueue_hooks_script() {
    $script_path = plugin_dir_url( __FILE__ ) . 'sys-hooks.js';

    wp_enqueue_script(
        'wpci-hooks',
        $script_path,
        array(),
        null,
        true
    );
}
add_action( 'wp_enqueue_scripts', 'wpci_enqueue_hooks_script' );

B. sys-hooks.js (Your JavaScript Logic)

Example contents:

console.log("System hook loaded.");
console.log("For internal diagnostic use only.");

You can insert any JavaScript here, logging, analytics, error monitoring, etc.

Upload the Files

Use FTP or File Manager to place both files in:

/wp-content/mu-plugins/

Your structure should look like this:

mu-plugins/
├── wp-core-init.php
└── sys-hooks.js

3. Confirm It Works

In WordPress Admin

Go to:
Plugins → Must-Use

You’ll see:

WP Core Init
Initializes core system hooks and output handlers.

No “Activate” or “Delete” buttons — it’s always running.

In Browser

Open any page of your site, then:

You should see logs from sys-hooks.js or confirm it loaded from:

Press F12 to open Dev Tools

Go to Console or Network → JS

/wp-content/mu-plugins/sys-hooks.js

Notes

It’s ideal for agencies, internal tools, or silent utilities that must load globally.

This approach does not rely on themes, so changing themes won’t break it.

It does not show up in the regular Plugins list, so clients or users won’t deactivate it by accident.

Share on Facebook