I apologize in advance if this question has been asked before.

I've created a plugin, and I'm trying to add an external stylesheet, but it's not working. Am I suppose to compress the plugin file and the stylesheet, and upload them then add a link to the stylesheet in the theme's php file?

  • please describe what u have tried in code till now.
    – Zammuuz
    Jul 15 '14 at 11:01

I'm assuming your plugin is working, you just don't get the stylesheet stuff to work?

In that case, you can use the wp_enqueue_scripts action.


For usage with a stylesheet in the pluginfolder, you can use it like this:

function my_plugin_name_scripts() {
    wp_enqueue_style( 'my-plugin-custom-styles', plugins_url('custom-styles.css' , __FILE__ ) );

add_action( 'wp_enqueue_scripts', 'my_plugin_name_scripts' );

Happy Coding, Kuchenundkakao

  • Thank you for your response! Yes my plugin is working, i tried following your instructions and I continue to receive a "Fatal error" whenever i try to incorporate the stylesheet
    – jude
    Jul 15 '14 at 15:18
  • What exactly is the Fatal Error saying? Jul 15 '14 at 17:46
  • Since it is a plugin so he should be hooking into more appropriate action.
    – gurung
    Aug 25 '15 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.