1. Home
  2. Docs
  3. Developer Documentations
  4. How to register plugin css file

How to register plugin css file

In every plugins, there is css file which is located in the css folder in every plugins. For example, if your plugin name is ‘test’, your css file will be located in this directory – plugins/test/css/

All the css files in a particular plugin must be registered for it to have effect on the plugin. The file that register the css file is ‘loader.php’ located inside the plugin.

If for example the plugin name is ‘test’, to register a css file for test plugin, go to loader.php in the test plugin directory and enter the following code (assuming the css filename is ‘test.css’):

register_asset("test::css/test.css");

The test:: is the name of the plugin in which the css folder is located.
The css/ is the css folder
The test.css is the css filename.

Thank you for reading.

Was this article helpful to you? Yes No

How can we help?