admin管理员组文章数量:1122832
I am currently developing a plugin and I need to get the handlers of various enqueued files in the theme. I have tried working with global $wp_scripts
and global $wp_styles
, but I only get the scripts and styles that are loaded for the backend (which is expected).
However, it is crucial for me to know the handlers in the backend so that I can dequeue them from there.
Can anyone help?
Best regards
Edit:
Here is an example of what I am trying to implement:
it should not only work with static paths but with different file types and files.
function json_file_handler() {
if (is_user_logged_in()) {
// Path to the staging JS file in the theme directory
$json_file_path = get_template_directory() . '/assets/js/staging_core.js';
// Check if the file exists
if (file_exists($json_file_path)) {
// If the file exists, dequeue the default script and enqueue the staging script
wp_dequeue_script('core');
wp_deregister_script('core');
wp_enqueue_script('staging-script', get_template_directory_uri() . '/assets/js/staging_core.js', array('jquery'), _S_VERSION, true);
}
}
}
sorry I don't know why it only shows one part as code
本文标签: pluginsFrontend Enqueued Files in the Backend
版权声明:本文标题:plugins - Frontend Enqueued Files in the Backend 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299579a1930506.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论