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
- Why use if function_exists?
- WordPress Multisite – global categories
- Include files in child theme functions file
- Check if post is being published for the first time, or is an already published post being updated
- How to get woocommerce inventory status [closed]
- How to call a function only once (global variable scope)
- Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?
- Enqueuing External Javascript functions.php
- Function to wrap the_content in a div
- How to run a function once on every post in database?
- Checked() showing up twice in custom fields
- Date/time limitation of posts where function must be executed
- Gravity Forms field entries into wp_query loop [closed]
- Generating rel=prev and rel=next only on wordpress categories
- How do I get a child theme to load scripts from the parent theme?
- How to make applyFilters function return false via functions.php
- Access / Filter block variations in Gutenberg, in WordPress 5.6
- example of build_query function?
- Avoid loading css from parent theme
- retrieve current user meta data (custom fields included)
- Calling a function from anywhere, used in different places
- async javascript and css for wordpress
- WooCommerce – Want to show multiple currency for a single product [closed]
- How add various functions within 1 conditional?
- Disable auto-resizing of uploaded images, but only for certain filename
- Add to cart php not working [closed]
- Create cron job for update translations automatically
- Login Redirect if Logged in from Specific Page
- get_next_posts_link not working without parameter max_num_pages
- create filter in functions.php
- Override the function twentytwelve_scripts_styles in a child theme
- Custom taxonomy widget in admin area
- What is the Difference in bones_comments() and comments.php
- Redirect to another page using contact form 7? [closed]
- Custom Sidebar only on single post
- Do I need to use wp_reset_postdata for my function?
- Can I have an additional functions.php file in WordPress?
- Split Media Queries in different files!
- functions.php and conditional tags
- how to make has_block() see inside blocks too
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Tracking the number of shortcodes for a list?
- How to print the current post depth as update notification?
- How to safely edit functions.php
- Changing the text of Upload/Insert on Posts and Pages Screen
- remove edit link only for published post and pending post
- When are the user meta fields created in the database? Admin vs Woo API REST
- How to automatically add counted number to navigation menu items?
- Insert Modal on user first login
- Trying to load JavaScript only on pages within a PODS category/ custom post type
- Correct way of Enqueue self hosted fonts in sass project
- function syntax is off,
- Language Switch Function
- Change category checkbox into radio button [duplicate]
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Show the online status of the current post’s author
- Functions.php in child theme that loads CSS file breaks website
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username
- clickable title of 2 post on mainpage USING functions.php
- Custom Post Type Search
- Problem with removing characters “<” – WpAllImport