admin管理员组

文章数量:1122832

I am using the same below code to dequeue many other styles but it is not working for Elementor, and a couple of others.

function enqueue_content(){
  wp_dequeue_style( 'elementor-icons-shared-0' );
  wp_dequeue_style( 'elementor-icons-fa-solid' );
  wp_dequeue_style( 'elementor-icons-fa-regular' );
add_action('wp_enqueue_scripts', 'enqueue_content', 20);

I have also tried the method described on their support:

EDIT: It seems as if the styles I can't dequeue are loading from a different, parent wp-content folder (it is a multisite).

I am using the same below code to dequeue many other styles but it is not working for Elementor, and a couple of others.

function enqueue_content(){
  wp_dequeue_style( 'elementor-icons-shared-0' );
  wp_dequeue_style( 'elementor-icons-fa-solid' );
  wp_dequeue_style( 'elementor-icons-fa-regular' );
add_action('wp_enqueue_scripts', 'enqueue_content', 20);

I have also tried the method described on their support: https://docs.elementor.com/article/286-speed-up-a-slow-site

EDIT: It seems as if the styles I can't dequeue are loading from a different, parent wp-content folder (it is a multisite).

Share Improve this question edited May 19, 2020 at 9:37 flinch85 asked May 19, 2020 at 8:50 flinch85flinch85 1012 bronze badges 2
  • 1 Have you tried increasing '20' to something like '100'? Also, consider installing the Debug Bar plugin(s) developer.wordpress.org/plugins/developer-tools/… They may be able to show you what priority the enqueue styles currently have. – Ted Stresen-Reuter Commented May 19, 2020 at 9:00
  • I have tried increasing the number. Unfortunately it's a site where I have no access to plugins. Have just realised it's a multisite and loading from two different wp-content folders. Edited question. – flinch85 Commented May 19, 2020 at 9:13
Add a comment  | 

1 Answer 1

Reset to default 0

I ran into the same issue. This snippet worked for me.

add_action('elementor/frontend/after_register_styles',function() {
    foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
        wp_deregister_style( 'elementor-icons-fa-' . $style );
    }
}, 20 );

You may only need the solid and regular dequeued.

add_action('elementor/frontend/after_register_styles',function() {
    foreach( [ 'solid', 'regular' ] as $style ) {
        wp_deregister_style( 'elementor-icons-fa-' . $style );
    }
}, 20 );

Elementor Reference

本文标签: phpCannot dequeue Elementor Font Awesome css