So I’m curious if anyone is doing this but I’d like to use the mu-plugin functionality to apply some settings. The issue is that I can’t seem to figure out how or if, I can do this directly from the MainWP dashboard. Ideally, a mu-plugin directory would have to be created and then the plugins can be installed within subdirectory. Normally subdirectories are not supported within the mu-plugin directory but using something like the following can allow one to create singe-purpose plugins. The problem is that currently, it seems all plugins by default are installed in the main plugin directory of a child site.
require(WPMU_PLUGIN_DIR . '/plugin1/plugin1.php');
require(WPMU_PLUGIN_DIR . '/plugin2/plugin2.php');
The use case I’m interested in is where you can create single-purpose plugins for filters like disabling lazy loading, disabling auto plugin updates, etc.
I think this approach may be complementary to the snippets plugins which is great for wp-config but I don’t think it can help with filters and such unless they are under the ABSPATH line in wp-config from what I have found.
Unless there is another automated way to add these useful snippets from the dashboard without having to manually add the to child sites functions.php?
I’m using mu-plugins for the same reason. You can just create the file and put it directly in the mu-plugins folder. I’m putting them there via the File Uploader Extension.
Thanks so much. I had never used the file uploader extension. What a nice way to handle it. I’m glad you are also using mu-plugins for this purpose. This is great.
While we are on the subject of mu-plugins, what snippets do you use? It seems you are more seasoned then I am so it would be nice if you can share any.
I’ve got some really simple snippets to adjust some update related settings:
/** Don't remind admins to check if the admin email needs to be changed (WP 5.3) */
add_filter( 'admin_email_check_interval', '__return_zero' );
/** Disable the possibility to enable automatic updates (WP 5.5) */
add_filter( 'plugins_auto_update_enabled', '__return_false' );
add_filter( 'themes_auto_update_enabled', '__return_false' );
/** Disable the possibility to enable automatic updates for WP core (WP 5.6) */
add_filter( 'allow_major_auto_core_updates', '__return_false' );
You can find some more snippets on this forum: Code Snippets - MainWP Community and sometimes they are discussed in other posts or in articles around the web. Make sure you always understand how the snippets work, so you know where to look if something doesn’t work as expected.
Thanks for sharing @josklever. Having the community of maintainers like yourself is really helping.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.