0

I have this code

add_action('admin_enqueue_scripts', 'my_admin_scripts_method');
function my_admin_scripts_method() {
       wp_enqueue_script('admin-control2',   plugin_dir_url( __FILE__ ) .'js/admin_control.js',array(),  PLUGIN_VERSION, true); 
}

When I'm logged in /wp-admin with an user that is administrator the js file is enqueued. However if I switch to an user that is editor role the js file is not included.

How can i fix this ? Is this the default behavior ?

Crerem
  • 1,289
  • 2
  • 18
  • 45

1 Answers1

0

If you want my 2 cents i would say that your problem reside outside that piece of code. Be 100% sure that your code is getting executed no matter what the user lvl is. For example, move it in the main plugin file outside any class scope and see if it work

Diego
  • 1,610
  • 1
  • 14
  • 26
  • You are right. It turns out that this is happening only when I edit a custom post type. On other pages it works as it should.Thanks! – Crerem Nov 17 '20 at 16:28
  • Please mark the answer as accepted so others will see it's closed – Diego Nov 17 '20 at 17:02