What you are looking for is a “MU-Plugin”– “Must-Use Plugin”.. Originally these were called “Multi-User Plugins” and were intended for exactly your purpose– to provide a way for site admins to enable functionality on all sites of an installation.
Create a directory at /wp-content/mu-plugins/ and put your PHP file(s) in it. WordPress will load the files automatically. MU-PLugins are “are automatically enabled on all sites in the installation” and cannot be deactivated except by physically removing the file.
Be sure to read the “Caveats” part of the Codex page.
Related Posts:
- Prevent “main” WPMU site_url() being returned in functions
- Implementing DNS Prefetching with WordPress
- Passing variables to templates (alternatives to globalizing variables)
- Different functions file for each site in multisite installation?
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Defining a global array in functions.php?
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Run function when WordPress new multisite is created or ACF field is updated
- Create a new query in function.php to filter blog posts
- Conditional Gravity Forms filter in WordPress Multisite
- Multisite Ajax serialize return error [object Object]
- Creating new blog on multisite programatically without hacks?
- How to get correct URLs in network wide menu (Multisite)?
- Multisite 404 on pages – rewrite error breaks database
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Function that outputs second theme url
- Passing global variable from header.php to functions.php
- How to Use Global Variables Inside Header and Footer
- dynamic site link for future migration in echo do_shortcode()
- Getting the teaser text without overriding global variables
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- functions.php return custom text
- Dashboard blocker on network multisite for specific user roles
- Members only function, but allow account activation [solved]
- External api call and make global variable for any page visitor enters , page-home, page, single etc
- Competing Login Redirects – Need to be Combined?
- How to access custom class methods from any include without using global
- Adding a class to the body of an inactive site using multisite
- Setting a cookie in functions.php and it gets deleted when working on an other function
- Settings in functions.php used by a plugin
- Run function from parent on child site
- How do I access variables outside a function [closed]
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- Filtering out the #more anchor link that gets produced by
- Does code run faster in functions.php than in different theme templates?
- file_get_contents – failed to open stream
- Exclude from the query posts with meta_key and meta_value
- Function to alphabetically sort custom post types creating duplicates
- wp_nonce_field is breaking form for reasons unknown
- How do I call a function to use on a page?
- get_post_meta() problem again
- Update users custom profile fields
- Variables not showing in short code
- Add back in child theme what the parent theme removed with remove_action
- replace text in Sort Box
- login_headertitle is deprecated since version 5.2.0
- Where is this JQuery coming from?
- Different favicon on different pages
- Javascript not loading after the document ready
- Need to convert image url to a Base_64 data url with wordpress function..
- What is the better for call files: bloginfo() or echo esc_url()?
- WordPress website keeps loading the maintenance page
- Setting Permalinks in wp_config or functions file?
- How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]
- loginout function customization
- How to place a div inside a function that creates a div
- Echo post title in post
- dynamic enquiry form [closed]
- Fatal error: allowed memory size when after using enqueue_script
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to redirect Subscribers on login to specific page, when logging in from a Page
- how can I add filter in specfic field in my website?
- How to change images url in function.php?
- Which filter fires upon setting a featured image
- Probleme shortcode with list author
- If has action not working as expected
- Stylesheet does not load despite functions.php
- How to customize archive widget only for cpt?
- How to show only specific category post by user role without plugin and restrict all other cats
- Shortcode to output category description by passing ID
- some profile informations like youtube link doesnt seem
- Help using ShortCodes to style whole chunks of the post
- Unable to declare AOS library in functions
- How to modify or override a core function (wp_star_rating)
- Removing sanitize_title_with_dashes Function with The Real Title
- Is there is a way to check daily first login?
- Graphic before title – Specific Category
- Printing medium sized image
- Filter posts on new page
- Sticky – Featured Image
- Pagination not working on my archive page for a custom post type
- WordPress Jquery+scripts enqueue issue
- Adding a jQuery rotator function
- How to pass a variable from a template page to the child theme functions.php
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Can’t change excerpt length and more tag
- Adding result from PHP function into an input field
- Echo a div to header.php from functions.php
- Making an under maintenance page (without using plugins)
- Image width issue in IE [closed]
- Changed functions.php file and now site is blank [closed]
- iOS and ajaxComplete
- disable a specefic sidebar when user is log out
- How to force Cover block to use the full size image resolution