{"id":204906,"date":"2022-02-24T04:04:41","date_gmt":"2022-02-24T04:04:41","guid":{"rendered":"https:\/\/wpmudev.com\/blog\/?p=204906"},"modified":"2022-02-24T04:04:41","modified_gmt":"2022-02-24T04:04:41","slug":"wordpress-mu-plugins","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/wordpress-mu-plugins\/","title":{"rendered":"WordPress MU-Plugins: What They Are + Useful Must-Use Plugins For WP Web Developers"},"content":{"rendered":"<p>Do you need features to activate automatically and remain enabled on your website? Then consider adding these to WordPress as an <em>mu-plugin<\/em>&#8230;even create your own!<\/p>\n<p>In this tutorial, we&#8217;ll explore:<\/p>\n<ul>\n<li><a href=\"#what-mu-plugins\">What Are MU-Plugins?<\/a><\/li>\n<li><a href=\"#history-mu-plugins\">A Brief History of MU-Plugins<\/a><\/li>\n<li><a href=\"#features-mu-plugins\">MU-Plugin Features<\/a>\n<ul>\n<li><a href=\"#change-dir-mu-plugins\">How to Change the Default Must-Use Plugins Directory<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#caveat-mu-plugins\">When Not to Use MU-Plugins<\/a><\/li>\n<li><a href=\"#install-mu-plugins\">How to Create and Install MU-Plugins in WordPress<\/a><\/li>\n<li><a href=\"#tutorials-mu-plugins\">MU-Plugin Tutorials<\/a>\n<ul>\n<li><a href=\"#hide-admin\">Hide WordPress Admin Item For All Users (Except You)<\/a><\/li>\n<li><a href=\"#custom-logout\">Hide WordPress Top Menu And Create A Custom Logout Button<\/a><\/li>\n<li><a href=\"#add-css\">Add CSS To the WordPress Backend<\/a><\/li>\n<li><a href=\"#remove-styles\">Remove All Styles From WordPress Content<\/a><\/li>\n<li><a href=\"#hide-elementor\">Hide Elementor In WordPress Admin<\/a><\/li>\n<li><a href=\"#behive-analytics\">Make Beehive Analytics Your WordPress Dashboard Home Page<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Let&#8217;s jump right in&#8230;<\/p>\n<h2 id=\"what-mu-plugins\">What Are WordPress MU-Plugins?<\/h2>\n<figure id=\"attachment_205748\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-205748\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/MU-Plugins.jpg\" alt=\"What are MU-Plugins?\" width=\"600\" height=\"450\" \/><figcaption class=\"wp-caption-text\">Can mu-plugins make WordPress sites fly?<\/figcaption><\/figure>\n<p>As described in <a href=\"https:\/\/wordpress.org\/support\/article\/must-use-plugins\/\" rel=\"noopener\" target=\"_blank\">WordPress.org&#8217;s documentation<\/a>&#8230;<\/p>\n<blockquote><p>Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation.<\/p><\/blockquote>\n<p>So, a <a href=\"https:\/\/wordpress.org\/support\/article\/must-use-plugins\/\" target=\"_blank\">must-use plugin<\/a> (\u2018mu-plugin\u2019) is just like any other WordPress plugin, except for the fact that when uploaded into the <code>mu-plugins<\/code> directory of the <code>wp-content<\/code> folder (i.e. <code>\/wp-content\/mu-plugins<\/code> it is automatically activated and remains enabled on your WordPress installation.<\/p>\n<h2 id=\"history-mu-plugins\">A Brief History of MU-Plugins<\/h2>\n<p>Back in the early days (<a href=\"https:\/\/wpmudev.com\/blog\/visual-history-wordpress\/\" target=\"_blank\" rel=\"noopener\">around version 3.0<\/a>), WordPress introduced a feature called <a href=\"https:\/\/wpmudev.com\/blog\/ultimate-guide-multisite\/\" target=\"_blank\" rel=\"noopener\">Multisite<\/a> (originally called WordPress MU) to allow multiple sites to share and be managed by one WordPress installation, WordPress Multisite (or WPMU as it became known) also introduced the \u2018mu-plugins\u2019 directory, offering site admins an easy way to activate plugins by default on all blogs in a multisite network.<\/p>\n<p>Although MU-plugins originally referred to &#8216;multi-user plugins&#8217;, they were renamed to &#8216;must-use&#8217; plugins.\u00a0 Installed in the \u2018mu-plugins\u2019 directory of a WPMU installation, mu-plugins can now be used wherever you want one or more plugins to automatically activate and remain enabled, whether on one or multiple WordPress installations.<\/p>\n<h2 id=\"features-mu-plugins\">MU-Plugin Features<\/h2>\n<p>A\u00a0<a href=\"https:\/\/wordpress.org\/support\/article\/must-use-plugins\/\" target=\"_blank\">must-use plugin<\/a> (\u2018mu-plugin\u2019) is a plugin that, by default, is automatically activated and remains enabled when uploaded into the <code>mu-plugins<\/code> directory of the <code>wp-content<\/code> folder (i.e. <code>\/wp-content\/mu-plugins<\/code>. Once uploaded into this directory, WordPress will automatically know that this plugin must be used on the installation.<\/p>\n<p>Must-use plugins are loaded before normal plugins and do not show in the default list of plugins on the Plugins page of wp-admin. They do, however, appear in a special Must-Use section in the Plugin screen&#8217;s list menu.<\/p>\n<figure id=\"attachment_205695\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-205695\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/mu-plugins-admin.png\" alt=\"Plugins screen - MU-Plugins\" width=\"600\" height=\"202\" \/><figcaption class=\"wp-caption-text\">A Plugins screen with Must-Use plugins loaded on the site.<\/figcaption><\/figure>\n<p>Notes:<\/p>\n<ul>\n<li>A mu-plugin cannot be deactivated or disabled except by removing the plugin file from the must-use directory of your WordPress installation.<\/li>\n<li>While the plugin remains in the directory, WordPress will always execute it. So, once an mu-plugin has been added to the mu-plugins directory, it remains &#8220;always on&#8221; until it is removed from that folder.<\/li>\n<li>Must-Use plugins do not update automatically and WordPress doesn\u2019t notify you about new versions. This means that mu-plugins have to be manually kept up-to-date (unless installed and maintained by an external service).<\/li>\n<li>Must-Use plugins can be enabled by simply uploading the file to the mu-plugins directory, without having to log-in.<\/li>\n<li>MU-plugins are loaded by PHP, in alphabetical order, before normal plugins. This means that API hooks added in an mu-plugin will apply to all other plugins even if they run hooked-functions in the global namespace.<\/li>\n<li>Also, keep in mind that mu-plugins will work on both single and multisite WordPress installations but will apply to every site in a multisite network.<\/li>\n<\/ul>\n<h3 id=\"change-dir-plugins\">How to Change the Default Must-Use Plugins Directory<\/h3>\n<p>To change the default directory manually, you will need to define two constants (<code>WPMU_PLUGIN_DIR<\/code> and <code>WPMU_PLUGIN_URL<\/code>) in <code>wp-config.php<\/code>:<\/p>\n<p><code>define('WPMU_PLUGIN_DIR', '\/full\/path\/to\/new\/directory');<\/code><br \/>\n<code>define('WPMU_PLUGIN_URL', 'https:\/\/URL\/to\/new\/directory');<\/code><\/p>\n<p><em>Notes:<\/em><\/p>\n<ul>\n<li>If you define the above constants and the path is not valid, WordPress won\u2019t redefine the constants and your mu-plugins won\u2019t load.\u00a0 So, unless you have a reason to change the default mu-plugins directory, we recommend sticking with the default values for <code>WPMU_PLUGIN_DIR<\/code> and <code>WPMU_PLUGIN_URL<\/code>.<\/li>\n<li>If changing the default directory, these two constants must be defined in the <code>wp-config.php<\/code> file before the line where the <code>wp-settings.php<\/code> file is included, so you won\u2019t be able to use useful constants (e.g. <code>WP_CONTENT_DIR<\/code>).<\/li>\n<\/ul>\n<h2 id=\"caveat-mu-plugins\">When Should You NOT Use MU-Plugins?<\/h2>\n<p>Must-use plugins let you add features to the WordPress core that are not installed by default but that users may need.<\/p>\n<p>However, as stated in the <a href=\"https:\/\/wordpress.org\/support\/article\/must-use-plugins\/\" rel=\"noopener\" target=\"_blank\">WordPress documentation<\/a>&#8230;<\/p>\n<blockquote><p>Despite its suitability for many special cases, the mu-plugins system is not always ideal and has several downsides that make it inappropriate in certain circumstances.<\/p><\/blockquote>\n<p>The documentation then goes on to list a number of important caveats to keep in mind:<\/p>\n<ul>\n<li>Plugins in the must-use directory will not appear in the update notifications nor show their update status on the plugins page, so you are responsible for learning about and performing updates on your own.<\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Function_Reference#register_activation_hook\" rel=\"noopener\" target=\"_blank\">Activation hooks<\/a> are not executed in plugins added to the must-use plugins folder. These hooks are used by many plugins to run installation code that sets up the plugin initially and\/or uninstall code that cleans up when the plugin is deleted. Plugins depending on these hooks may not function in the mu-plugins folder, and as such all plugins should be carefully tested specifically in the mu-plugins directory before being deployed to a live site.<\/li>\n<\/ul>\n<p>Note: WordPress only looks for PHP files right inside the mu-plugins directory, and (unlike for normal plugins) not for files in subdirectories. You may want to create a proxy PHP loader file inside the mu-plugins directory:<\/p>\n<pre>&lt;?php \/\/ mu-plugins\/load.php\r\nrequire WPMU_PLUGIN_DIR.'\/my-plugin\/my-plugin.php';<\/pre>\n<h3>Keep It Simple With Mu-Plugins<\/h3>\n<p>Mu-plugins should only be used to do &#8220;one&#8221; simple action. Calling complex code all the time might lead to conflict with other code or plugins and involving mu-plugins as suspected sources when troubleshooting conflicts can really complicate things.<\/p>\n<h3>MU-Plugins Can&#8217;t Be Stored in Subdirectories<\/h3>\n<p>Additionally, keep in mind that, unlike regular plugins, you can&#8217;t store an mu-plugin in a subdirectory of the mu-plugins directory. This means that you won\u2019t be able to sort your mu-plugins using folders by default.<\/p>\n<p>You could get around this by <a href=\"https:\/\/www.sitepoint.com\/wordpress-mu-plugins\/#:~:text=enjoy%20the%20result!-,Subdirectories,-Contrary%20to%20a\" rel=\"noopener\" target=\"_blank\">creating an mu-plugin<\/a> to make WordPress automatically included mu-plugins stored in subdirectories, but as they are not found by WordPress by default, they won\u2019t appear in the must-use plugins list, so you won\u2019t be able to see which must-use plugin is installed in subdirectories without looking at the mu-plugins directory itself.<\/p>\n<h2 id=\"install-mu-plugins\">How To Create and Install MU-Plugins in WordPress<\/h2>\n<p>Adding a must-use plugin to your site requires three steps:<\/p>\n<ol>\n<li>Create an <code>mu-plugins<\/code> directory (folder) in the <code>wp-content<\/code> directory<\/li>\n<li>Create an mu-plugin php file<\/li>\n<li>Upload\/install the file on your site via FTP<\/li>\n<\/ol>\n<p>We have created an excellent step-by-step tutorial that shows you <a href=\"https:\/\/wpmudev.com\/docs\/using-wordpress\/installing-wordpress-plugins\/#installing-mu-plugins\" target=\"_blank\" rel=\"noopener\">how to install MU-plugins in WordPress<\/a> in our documentation section.<\/p>\n<p>Follow the above tutorial to go through the entire process, or click on a link below to go to one of the above steps:<\/p>\n<ul>\n<li><a href=\"https:\/\/wpmudev.com\/docs\/using-wordpress\/installing-wordpress-plugins\/#create-an-mu-plugin-directory\" target=\"_blank\" rel=\"noopener\">Create an mu-plugin directory<\/a><\/li>\n<li><a href=\"https:\/\/wpmudev.com\/docs\/using-wordpress\/installing-wordpress-plugins\/#create-the-mu-plugin-file\" target=\"_blank\" rel=\"noopener\">Create an mu-plugin<\/a><\/li>\n<li><a href=\"https:\/\/wpmudev.com\/docs\/using-wordpress\/installing-wordpress-plugins\/#uploadinstall-the-file\" target=\"_blank\" rel=\"noopener\">Upload\/Install an mu-plugin file<\/a><\/li>\n<\/ul>\n<h2 id=\"tutorials-mu-plugins\">Add These Useful Must-Use Plugins To Your WordPress Toolbox<\/h2>\n<p><em><strong>Warning:<\/strong> We strongly recommend performing a complete backup of your site before changing things or adding code to server files in case anything goes wrong. <a href=\"https:\/\/wpmudev.com\/project\/snapshot\/\" target=\"_blank\" rel=\"noopener\">Snapshot<\/a> makes backing up and restoring WordPress sites a breeze!\u00a0<\/em><\/p>\n<p>If you are a WordPress developer or manage websites for your team or your clients, here are some useful mu-plugins you can create to expand your bag of tricks:<\/p>\n<h3 id=\"hide-admin\">1. Hide WordPress Admin Bar For All Users (Except You)<\/h3>\n<div class=\"post-text\" data-swiftype-index=\"true\">\n<p>If you manage websites for your team or your clients, or are the head developer of your business, you may want to make WordPress customizations that only you can see, or hide buttons for all users other than you to be sure people don&#8217;t click where they shouldn\u2019t .<\/p>\n<p>While you can customize admin tools using a plugin like <a href=\"https:\/\/wordpress.org\/plugins\/branda-white-labeling\/\" rel=\"noopener\" target=\"_blank\">Branda<\/a>, you can also do this easily using code.<\/p>\n<p>For this example, let&#8217;s say that you are the only superadmin of a site and want to hide the toolbar for every user except yourself.<\/p>\n<p>Just create a mu-plugin and add the following code and style it using CSS:<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">&lt;?php\r\nadd_action( 'admin_footer', 'hideitems' );\r\nfunction hideitems() {\r\n   if ( ! is_super_admin() ) {\r\n      echo \"&lt;style&gt;\r\n         #wpadminbar {\r\n            display: none !important;\r\n         }\r\n      &lt;\/style&gt; \";\r\n   }\r\n}<\/pre>\n<h3 id=\"custom-logout\">2. Hide WordPress Top Menu And Create A Custom Logout Button<\/h3>\n<p>Here&#8217;s another WordPress admin customization you can do for your clients.<\/p>\n<p>Let&#8217;s say you want to hide or remove the top bar on your client sites&#8217; admin areas because you find it&#8217;s inconvenient to have it display there or feel that giving clients who don&#8217;t know much about WordPress access to content modification menus could lead to them making inadvertent mistakes.<\/p>\n<p>For example, if you build sites using Elementor, your clients can access Elementor&#8217;s theme customization options directly from the top menu bar.<\/p>\n<figure id=\"attachment_205690\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-205690\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/add-new-template.png\" alt=\"Add new Elementor template in WordPress toolbar.\" width=\"600\" height=\"255\" \/><figcaption class=\"wp-caption-text\">Users can add a new Elementor template in their WordPress toolbar.<\/figcaption><\/figure>\n<p>Sticking with Elementor for this example, you may decide to hide this to avoid problems and leave the theme customization path inside the admin area at Templates &gt; Theme Builder. Or you may decide to remove it altogether, because even if you disable options from the admin bar, some users may still not understand what it is and why it displays on the front end of their sites.<\/p>\n<p>Hiding the top bar is very easy to do using a plugin like Branda&#8230;just go to Admin area &gt; Admin bar and then uncheck the toolbar visibility for some users.<\/p>\n<p>The problem is, if you completely disable this bar, users won&#8217;t be able to logout from their admin. This not only creates a security issue, it&#8217;s also not convenient if you want to switch users.<\/p>\n<p>Fortunately, there is a solution: Simply add this code as a mu-plugin to create a logout button:<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">&lt;?php\r\nadd_action(\r\n   'admin_menu',\r\n   function () {\r\n      add_menu_page(\r\n         'Logout',\r\n         'Logout',\r\n         'read',\r\n         'wp_custom_logout_menu',\r\n         '__return_false',\r\n         'dashicons-marker',\r\n         1 \/\/ Here use 1 for placing menu on top or PHP_MAX_INT to place it at the bottom,\r\n      );\r\n   }\r\n);\r\n\r\nadd_action(\r\n   'admin_init',\r\n   function () {\r\n      if ( isset( $_GET['page'] ) &amp;&amp; $_GET['page'] == 'wp_custom_logout_menu' ) {\r\n         wp_redirect( wp_logout_url() );\r\n         exit();\r\n      }\r\n   }\r\n);<\/pre>\n<p>This will redirect your user to the login page after the logout process.<\/p>\n<h3 id=\"add-css\">3. Add CSS To WordPress Backend<\/h3>\n<p>How can you add CSS to the WordPress backend?<\/p>\n<p>Once again, you can use a plugin like Branda, but you could also create an mu-plugin and paste the following code in your file:<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">&lt;?php\r\nadd_action( 'admin_footer', 'my_admin_css' );\r\nfunction my_admin_css() {\r\n   echo '&lt;style&gt;\r\n      \/*Put your CSS code here*\/\r\n   &lt;\/style&gt;';\r\n}<\/pre>\n<p>That&#8217;s it&#8230;easy and very handy!<\/p>\n<h3 id=\"remove-styles\">4. Remove All Styles From WordPress Content<\/h3>\n<p>Suppose you come across a site where all the content style is set by HTML within the WordPress content.<\/p>\n<p>This is kind of a bummer, since no one really wants to modify the style of each page when you can easily do this using CSS.<\/p>\n<p>So, here&#8217;s a workaround for this.<\/p>\n<p>Create a mu-plugin, and add the following code:<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">add_filter(\r\n   'the_content',\r\n   function ( $content ) {\r\n      \/\/ Delete all inline style.\r\n      return preg_replace( '\/ style=(\"|\\')(.*?)(\"|\\')\/', '', $content );\r\n   }\r\n);<\/pre>\n<p>Try it out!<\/p>\n<h3 id=\"hide-elementor\">5. Hide Elementor In WordPress Admin<\/h3>\n<p><a href=\"https:\/\/wpmudev.com\/blog\/best-wordpress-page-builders-compared\/\" target=\"_blank\" rel=\"noopener\">Elementor<\/a> is one of the popular and widely-used page builders for WordPress. If you are a web developer or webmaster, you may be using Elementor to create and manage a website and its content.<\/p>\n<p>As easy as Elementor is, it still requires some knowledge to use it and an inadvertent mistake by a user could make the site impossible to navigate.<\/p>\n<p>So, if you are the only one managing the website and users don&#8217;t need to create pages in WordPress very often, you might want to hide Elementor options from other backend users. Making sure there is no modification happening to the backend without your knowledge will give you peace of mind and your customers or backend users may also appreciate having a simpler interface to work with.<\/p>\n<p>This tip works well on the following kinds of sites:<\/p>\n<ul>\n<li>eCommerce sites<\/li>\n<li>Websites with custom posts types<\/li>\n<li>Websites used mainly as a blog to publish articles.<\/li>\n<\/ul>\n<p>As stated earlier, if end users need to regularly create WordPress pages, this might not work for you because they will need Elementor for this.<\/p>\n<p>Before creating an mu-plugin, first you must hide Elementor in the menu. You can then hide the Elementor button on WordPress pages.<\/p>\n<p><strong>1. Hide Elementor in the menu<\/strong><\/p>\n<p>Install Branda and then:<\/p>\n<ul>\n<li>Go to Admin area &gt; Admin bar and hide it for your end users. This way they will not be able to access the Elementor builder from there.<\/li>\n<li>Go to Dashboard &gt; Admin menu &gt; Customize and then hide the Elementor admin menu for everyone except you (tip: use user roles for this as it is easier than doing it for every user).<\/li>\n<li>Remember to also hide the \u201cTemplates\u201d menu (this is probably the most critical thing to hide).<\/li>\n<\/ul>\n<p>Note: We recommend that only one person should be able to access the templates, especially if using these to build your theme and using CSS to control every item of your site&#8217;s design. This prevents other users from adding CSS elsewhere (e.g. in builders, theme customizer, stylesheets, etc.)&#8230;and without commenting properly when adding code, e.g.<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">\/* Header customization *\/\r\n.header{\r\n   margin-top: 10px;\r\n}\r\n\/* END Header customization *\/<\/pre>\n<p><strong>2. Hide the Elementor button on WordPress pages<\/strong><\/p>\n<p>The easiest way to create or modify a page with Elementor is simply to go to <strong>Pages &gt; Create<\/strong> and click on the Elementor button to change it.<\/p>\n<p>There is also a way to hide this button if you do not want users to access Elementor at all.<\/p>\n<p>To do this, you need to customize <a href=\"https:\/\/wpmudev.com\/blog\/customize-wordpress-user-roles-branda-white-label\/\" target=\"_blank\" rel=\"noopener\">user roles<\/a>. If you are the only admin of the site, you can hide the buttons for everyone except you.<\/p>\n<p><em>Note:<\/em> You can use the previous step to hide the Elementor templates only (to keep your theme safe) but still leave access in Elementor to create and modify pages. This, however, can be risky, since when users are on an Elementor page, they can navigate to other elements like the header or footer, or access Elementor global settings that will affect the site.<\/p>\n<p>Once you have done the above, the only thing left to do is create a mu-plugin and paste the following code to hide the button :<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">&lt;?php\r\nadd_action( 'admin_footer', 'hideitems' );\r\n\r\nfunction hideitems() {\r\n   if ( ! is_super_admin() ) {\r\n      ?&gt;\r\n        &lt;style&gt;\r\n            #elementor-switch-mode {\r\n                display: none;\r\n            }\r\n        &lt;\/style&gt;\r\n      &lt;?php\r\n   }\r\n}<\/pre>\n<p>Enjoy!<\/p>\n<h3 id=\"beehive-analytics\">6. Make Beehive Analytics Your WordPress Dashboard Home Page<\/h3>\n<p>If you are not a huge fan of the WordPress admin page (even if you can customize its widgets and hide panels) or having your users see this screen every time they log into their WordPress dashboard&#8230;<\/p>\n<figure id=\"attachment_205758\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-205758\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/wp-admin-page.png\" alt=\"WordPress Dashboard Screen\" width=\"600\" height=\"318\" \/><figcaption class=\"wp-caption-text\">Look but don&#8217;t look&#8230;is this what you want users to see when they log in?<\/figcaption><\/figure>\n<p>Why not show them a beautiful admin landing page with useful information like this?<\/p>\n<figure id=\"attachment_205759\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-205759\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/beehive-analytics.png\" alt=\"Beehive Pro Analytics screen\" width=\"600\" height=\"887\" \/><figcaption class=\"wp-caption-text\">Oooh&#8230;aaah&#8230;charts and stats&#8230;that&#8217;s much better!<\/figcaption><\/figure>\n<p>Again, you can use <a href=\"https:\/\/wpmudev.com\/blog\/how-to-get-the-most-out-of-using-branda\/\" target=\"_blank\" rel=\"noopener\">Branda<\/a> to customize the admin panel and the left menu or hide\/show menus depending on the user role. This is great if you are the only admin and want to display the minimum required menus for end users or add custom CSS.<\/p>\n<p>If, however, all you want to do is redirect users from the WordPress admin page to a more useful page like the Beehive analytics page, then simply create an mu-plugin and add this code:<\/p>\n<pre style=\"white-space: pre; overflow: auto;\">&lt;?php\r\nfunction wpmudev_redirect_page() {\r\n   global $pagenow;\r\n   if ( $pagenow == 'index.php' &amp;&amp; ! wp_doing_ajax() &amp;&amp; is_plugin_active( 'google-analytics-async\/google-analytics-async.php' ) ) {\r\n\r\n      wp_redirect( admin_url( '\/admin.php?page=beehive-google-analytics' ) );\r\n      exit;\r\n   }\r\n}\r\n\r\nadd_action( 'admin_init', 'wpmudev_redirect_page' );<\/pre>\n<p>Enjoy!<\/p>\n<h2>Make WordPress Fly With MU-Plugins<\/h2>\n<p>Hopefully, now you know all about Must-Use plugins: what they are, when and when not to use them, and how and where to install them on WordPress sites.<\/p>\n<p>Check out our <a href=\"https:\/\/wpmudev.com\/docs\/using-wordpress\/installing-wordpress-plugins\/#installing-mu-plugins\" target=\"_blank\" rel=\"noopener\">mu-plugins documentation<\/a>, try creating and installing some must-have plugins of your own, and if you experience any issues or need expert help, contact our support team&#8230;we&#8217;re available 24\/7 to answer any WordPress questions you have!<\/p>\n<h3>Contributors<\/h3>\n<p>This article was written in collaboration with:<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><a rel=\"noopener\" class=\"blog-thumbnail\" href=\"https:\/\/incensy.com\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-205768\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2022\/02\/incensy-logo.png\" alt=\"Incensy\" width=\"250\" height=\"76\" \/><\/a><\/div>\n<\/div>\n<p><strong>Antoine<\/strong> &#8211;\u00a0 <a href=\"https:\/\/incensy.com\/\" rel=\"noopener\" target=\"_blank\">Incensy<\/a>.\u00a0\u00a0I am passionate by web culture and digital solutions. I have been working in this area for 11 years now. Always looking for the best solutions to help my customers overcome digital challenges and grow their business online. My vision of digital success: Get a global strategy, apply it with detailed precision, and always keep improving.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Do you need features to activate automatically and remain enabled on your website? Then consider adding these to WordPress as an mu-plugin&#8230;even create your own! In this tutorial, we&#8217;ll explore: What Are MU-Plugins? A Brief History of MU-Plugins MU-Plugin Features How to Change the Default Must-Use Plugins Directory When Not to Use MU-Plugins How to [&hellip;]<\/p>\n","protected":false},"author":774618,"featured_media":204935,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[],"tutorials_categories":[],"class_list":["post-204906","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/204906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/774618"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=204906"}],"version-history":[{"count":63,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/204906\/revisions"}],"predecessor-version":[{"id":206735,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/204906\/revisions\/206735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/204935"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=204906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=204906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=204906"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=204906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}