itszy
October 25, 2016, 3:40pm
1
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!
UXBARN
October 25, 2016, 3:50pm
2
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
itszy
October 26, 2016, 8:14am
3
Thank you very much for answer
So you are thinking that in backend I should fix it too?
UXBARN
October 28, 2016, 8:13am
4
Yep. You should put any inline code into the files and enqueue them depending on the admin screen users are viewing.
1 Like
itszy
October 28, 2016, 8:43am
5
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?