Fail on admin_enqueue_scripts when I try it to upload a CSS file to my WordPress Plugin
I currently doing a WordPress Plugin and I am successful when I try to put CSS or JavaScript on the frontend but I don't know on where I fail when I trying to do the same on backend side, this is my code:
function my_function($hook) {
global $post;
if($hook == 'post-new.php' || $hook == 'post.php') {
if($post-post_type == 'post_type_name') {
wp_enqueue_style('adminCSS', plugins_url('../assets/css/admin.css', __FILE__) );
}
}
}
add_action( 'admin_enqueue_scrips', 'my_function');
As you see on my code I only want the CSS file on the plugin's post type side, that's why I do all the stuff with the $hook and the post type. Can you tell me what error I made there?
Topic plugins-url hooks plugins Wordpress
Category Web