Articles of mu plugins

How to use a Must-Use plugin to hide a regular one and to hide itself?

When solving this issue ( Change admin language based on user (in single-site) ), I did a function so that the plugin would auto-hide from all users except one (me:). The flaw is that it only auto-hides when active. At first, it was a mu-plugin, but I had to enable/disable it manually. It really doesn’t […]

Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?

Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php? I have a mu-functions.php file in the mu-plugins folder. One function calls a javascript file (alerts.js) located in example.com/wp-content/mu-plugins/js/. How can I target the mu-plugins folder in my function? Currently, I am using get_site_url() . ‘/wp-content/mu-plugins/js/alerts.js’, Although not completely relevant to the […]

Auto Load Plugin Hooks inside Must Use Plugin

I am creating a custom MU plugin to run on a multi-site network. I am working on a function that will dynamically include files containing additional action and filter hooks based on the active plugins for the current website being processed. The problem is, my function is not called when I visit a child site. […]

POEdit with Custom mu-plugins code

I have a very strict directory structure I must adhere to within mu-plugins, but I would like POEdit to be able to help me generate translation files for specific code within this structure, while ignoring a bunch of others. At the moment, POEdit is having difficulty locating valid code. I have purchased the Pro version, […]

Must-use plugins autoloader: How to use get_plugins() correctly?

My autoloader class is responsible for loading must-use plugins that do not sit in the root of the mu-plugins folder. To locate them, I need to use the get_plugins() function. According to Codex, the function accepts one parameter: $plugin_folder (string) (optional): Relative path to single plugin folder. My file hierarchy looks like this: |– /mu-plugins […]

Namespacing WordPress project according to FIG standards

I am trying to wrap my head around the namespaces, autoloaders and FIG standards and most importantly how to achieve their integration to WordPress as close as possible. Here is my file structure, created with help of awesome roots/bedrock WordPress stack. |– /web | |– /app | | |– /mu-plugins | | | |– autoload.php […]

Plugins in mu-plugins folder are not loaded

I’m trying to load plugins automatically by putting the plugins into mu-plugins folder. But if the plugin is put in a folder, it isn’t loaded. I tried some popular plugins such as W3 Total Cache, WordPress SEO By Yoast, but all of them are not loaded. Does WordPress only loads plugins which are just single […]

Customize default settings on new sites on multisite

As the title states i need an approach to change default settings when a new site is created on my wordpress multi site. I guess its easiest to keep the code in a mu-plugin but can a go about having specific default options like: frontpage as static page create a default page and set it […]

How to prevent redirect to 'About' after core upgrade?

In wp-admin/includes/update-core.php we find the following line: add_action( ‘_core_updated_successfully’, ‘_redirect_to_about_wordpress’ ); I want to remove this action, so I created a mu plugin with the following content: <?php # -*- coding: utf-8 -*- add_action( ‘_core_updated_successfully’, ‘t5_no_redirect_after_update’, 0 ); function t5_no_redirect_after_update() { remove_action( ‘_core_updated_successfully’, ‘_redirect_to_about_wordpress’ ); } It does … nothing. I am still redirected. Tested […]