admin管理员组文章数量:1326076
I got one plugin which generates all CSS and JS on the /wp-content/uploads/xyz-folder, I want to disable all this CSS and JS load on my website page.
Is it possible?
I got one plugin which generates all CSS and JS on the /wp-content/uploads/xyz-folder, I want to disable all this CSS and JS load on my website page.
Is it possible?
Share Improve this question asked Aug 1, 2020 at 16:28 abid_hasan112abid_hasan112 11 bronze badge2 Answers
Reset to default 1If you know what the names of the handles that the plugins use are, you can locate them using this code and then just use a simple wp_dequeue_script
function.
function wp_inspect_scripts() {
global $wp_scripts;
echo '<pre><h1>Script Handles</h1><ul>';
foreach( $wp_scripts->queue as $handle ) :
echo '<li>' . $handle . '</li>';
endforeach;
echo '</ul></pre>';
}
add_action( 'wp_print_scripts', 'wp_inspect_scripts' );
function wp_inspect_styles() {
global $wp_styles;
echo '<pre><h1>Style Handles</h1><ul>';
foreach( $wp_styles->queue as $handle ) :
echo '<li>' . $handle . '</li>';
endforeach;
echo '</ul></pre>';
}
add_action( 'wp_print_styles', 'wp_inspect_styles' );
Add the above code to your themes functions.php
file for this to work.
If the plugin dynamically generates script and style handles so that you can't use wp_dequeue_script
and wp_dequeue_style
, as you said in a comment on another answer, then you would need to fork the plugin, and remove the section of code that is doing that, or else wrap it in a conditional so that it only loads on the specific page in question. (Fork, because your changes will be overwritten by the next plugin update).
本文标签: functionsWant to dequeue all the CSS and JS from wpcontentuploadsxyzfolder
版权声明:本文标题:functions - Want to dequeue all the CSS and JS from wp-contentuploadsxyz-folder 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742195102a2430933.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论