Soft reject - hardcoded JS/CSS - admin area too?

Hi guys,

My theme was soft-rejected and this is one of points:
Scripts and styles should not be hardcoded anywhere in your theme or added any other way but with wp_enqueue* hook and to be added from the functions file. This includes custom JS/CSS._
For inline styles use: https://developer.wordpress.org/reference/functions/wp_add_inline_style/ and for scripts https://developer.wordpress.org/reference/functions/wp_add_inline_script/

Ok we have fixed code in all places in front but what about inline styles & scripts in backend? It is written brightly: “anywhere in you theme” but maybe its refer only to front?

What do you think?
Thanks, Cheers!

Hi there,

For the admin area, you can use “admin_enqueue_scripts” action hook to enqueue CSS and JS files.

More info here: https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

:slight_smile:

Thank you very much for answer :slight_smile:

So you are thinking that in backend I should fix it too?

Yep. You should put any inline code into the files and enqueue them depending on the admin screen users are viewing.

1 Like

Thanks, I’ve fix it. I left only inline styles which are adding via ajax so I cant to add them via this hooks, but I think its normal, isnt it? :slight_smile: