Why are admin scripts not printed
-
30-10-2019 - |
Question
I am trying to enqueue/print scripts in the admin area. But they dont seem to appear.
add_action('admin_init', function() {
add_meta_box('portfolio-meta', 'Details', 'portfolio_metabox_details', 'portfolio');
wp_register_script('jqeury-validate', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js');
wp_enqueue_script('jquery-validate');
wp_register_script('ae-admin', get_bloginfo('template_directory') . '/js/admin.js', array('jquery', 'jquery-validate'));
wp_enqueue_script('ae-admin');
wp_localize_script('ae-admin', 'WpAjax', array(
'AjaxUrl' => admin_url('admin-ajax.php')
));
wp_register_style('ae-validate', get_bloginfo('template_directory') . '/css/validate.css');
wp_enqueue_style('ae-validate');
});
But my script (admin.js
) does not seem to get printed. I even tried to put those in 'init' instead of 'admin_init' still I dont see my scripts ... why is that? How can I debug?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange