I am working on a Wordpress plugin where I want to include some jquery scripts and stylesheet. I found dit piece of code in an article and this should do the job, but it doesn't work for me. Can someone tell me what I am doing wrong?

// Include files
function my_scripts() {
    wp_enqueue_script( 'jquery' );
    wp_register_style( 'filename.css', plugins_url('filename.css', __FILE__) );
    wp_enqueue_style( 'filename.css' );

  • Are you trying to include the files on the front end, or on the back end plugin page?
    – s_ha_dum
    Nov 28, 2013 at 15:58
  • With your code, filename.css should be in the same directory where the file having the above code is present. Is this correct? Nov 28, 2013 at 17:40
  • @s_ha_dum In the back end of the plugin page.
    – Robbert
    Nov 29, 2013 at 8:24
  • @Chittaranjan Yes it's in the same directory.
    – Robbert
    Nov 29, 2013 at 8:25

1 Answer 1


wp_enqueue_scripts is a front-end hook. It will not execute on the back-end. You need to use admin_enqueue_scripts instead. This is even mentioned on the Codex page just refrerenced.

See also:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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