Please let me know which code snippets for which plugins would be of the most use?
Hi, any chance you could share a snippet code to rearrange the order of Mainwp menu? Thanks
So change the menu item order in the MainWP dashboard site.
Yes this could be useful, as well as adding new menu item with custom link snippet.
thanks
At the moment Iām looking for code snippets to add to a custom mu-plugin, that will be installed on all the sites I manage for clients. So Iām looking for snippets regarding security, updates, monitoring hosting environment etc.
Iām already blocking the admin email check and have removed the automatic updater options. Iāll continue my search.
These would be good ones to add to the mu-plugin.
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
add_filter( 'wp_sitemaps_enabled', '__return_false' );
add_filter( 'plugins_auto_update_enabled', '__return_false' );
add_filter( 'themes_auto_update_enabled', '__return_false' );
add_filter( 'auto_plugin_update_send_email', '__return_false' );
add_filter( 'auto_theme_update_send_email', '__return_false' );
Using a mu-plugin is a great idea. I would also add:
// Disable the site health dashboard widget
add_action(āwp_dashboard_setupā, āremove_site_health_dashboard_widgetā);
function remove_site_health_dashboard_widget()
{
remove_meta_box(ādashboard_site_healthā, ādashboardā, ānormalā);
}
// Disable the URL field from the WordPress comment form on your child site.
add_filter(ācomment_form_field_urlā, ā__return_falseā);`
// Disable checking of admin email
add_filter( āadmin_email_check_intervalā, ā__return_falseā );
Yep those are some handy code snippets as well.
@sebastian-moran - You mentioned a mu-plugin but how you set up one from MainWP and push it to the child?
Do you create your own plugin and then push it to all sites and edit the function when needed?
@wpexpert Iāve created one and uploaded it to all my clients with the File Uploader Extension to /wp-content/mu-plugins/. That makes it much easier (and faster when managing many sites) to add these code snippets to a new child.
Thanks, @josklever. We have more than 95 sites, do you have ever encountered any conflicts with other plugins?
Conflicts between other plugins and what? The mu-plugin? I only use it for snippets, that can be used on all (240) sites, like disabling the āauto update settingsā from WP 5.5.
For more specific snippets you can create separate plugins and push them only to sites in a certain group.
Must-use plugins get loaded before plugins are loaded in WordPress.
I didnāt know that! Thanks so less chance to have a conflict with a plugin thenā¦