Hi! My name is

NASTIA

I’m a WordPress enthusiast, proud to be WPMU DEV-ian, site builder and amateur photographer.

How To Add CSS Code In MU Plugin

Nastia
0 Comments

A must-use plugin (also called a ‘mu-plugin’) is a plugin that will always be activated by default, without you needing to do it yourself. To activate a mu-plugin, you just have to upload it in the right directory, and WordPress will automatically know that this plugin must be used. Moreover, a mu-plugin cannot be deactivated: it will always be executed, unless it is uninstalled.

Originally, mu-plugins were only available for WPMU, for those sites which used multiple (multisite) blogs. Back then, a mu-plugin was just a plugin activated for all blogs.

Fun fact, that the WordPress is loading mu-plugins in alphabetical order, before normal plugins.

All mu-plugins must be placed at wp-content/mu-plugins by default, in case /mu-plugins/ folder is not there, feel free to create it.

Add CSS code in mu-plugin

Create a file named style.php and add the following code inside.

<?php
add_action( 'wp_head', function() {
 ?>
 <style>
 
/* YOUR CSS CODE GOES HERE*/

 </style>
 <?php
} );

Add your CSS code between

<style></style>

tags.

 

 

Fell free to comment bellow if you have something new to add 🙂

Categories
WordPress
COMMENTS (No comments)

Leave a Reply

Your email address will not be published. Required fields are marked *