WordPress.org

Ready to get started?Download WordPress

Forums

Multisite javascript - where's the right place? (3 posts)

  1. dbvista
    Member
    Posted 3 years ago #

    Where is the right place to install JavaScript to affect all sites on a multisite setup? Based on other docs I read, you're supposed to put JavaScript into wp-content/themes/name-of-your-theme/*.js and reference it from functions.php. But this is bad for several reasons:

    • It affects only 1 theme, and in multisite, there may be many themes active.
    • Updating the theme may overwrite the functions.php file, losing your changes.

    So what is the right approach? Some examples of what I'm trying to do with JavaScript:

    • On wp-admin/post-new.php, require the new post to have a non-blank title
    • Add and hide some gadgets on wp-admin/user-new.php

    Thank you.

  2. dbvista
    Member
    Posted 3 years ago #

  3. Toss it in mu-plugins, that'd do it too. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.