• Resolved harvoolio

    (@harvoolio)


    I love the plugin. But FontAwesome is now loaded twice, since another plugin loads FontAwesome from maxcdn.bootstrapdn.com. Unfortunately that plugin loads right after AccessPress since plugins with the same priority are loaded in alphabetical order. Therefore AccessPress does not see this other FontAwesome as already enqueued.

    Is there a way to dequeue your plugin’s Font Awesome or even better is there a way to deregister, register and enqueue your scripts again with a lower priority so your script sees FontAwesome as already enqueued and therefore does not enqueue it? Or how do I deregister it so I can register maxcdn.bootstrapdn.com’s version or do you want to load from that cdn in your next update?

    Presently, I was able to dequeue the cdn’s Font Awesome in print styles but this is not the ideal solution.

    // Remove multiple copies of Font Awesome	
    
    function remove_unwanted_css(){
    	wp_dequeue_style('font-awesome');
    }
    add_filter('wp_print_styles', 'remove_unwanted_css');

    Thanks.

    https://www.ads-software.com/plugins/accesspress-social-counter/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Access Keys

    (@access-keys)

    Hello there,

    Did you try what we had suggested in the email that you had sent to us lately?That should work probably as since each and every enqueued style will have a specific handle and the priorities shouldn’t matter as since you will dequeue the style with specic enqueue handle.

    Please try below code once.

    add_action( 'wp_enqueue_scripts', 'remove_font_awesome', 20 );
    
    function remove_font_awesome(){
        wp_deregister_style( 'apsc-font-awesome-css' );
        wp_dequeue_style( 'apsc-font-awesome-css' );
    }

    Thanks.

    Thread Starter harvoolio

    (@harvoolio)

    I must have missed that email. I am sorry.

    I tried the function written as is but I cannot remove apsc-font-awesome-css whether in wp_enqueue_scripts or wp_print_styles. I suspected the reason is because apsc-font-awesome-css is listed as a dependency of apsc-frontend-css.

    Since I am only using the plugin for the counter, I tried to remove all CSS. So I wrote the function below. Only apsc-frontend-css could be removed and only if hooked into wp_print_styles. Is there a better function for removing all add CSS thanks.

    add_action( 'wp_print_styles', 'remove_apsc_css');
    
    function remove_apsc_css(){
    	 wp_deregister_style( 'apsc-font-awesome-css' );
        wp_dequeue_style( 'apsc-font-awesome-css' );
    	wp_deregister_style( 'apsc-frontend-css' );
    	wp_dequeue_style( 'apsc-frontend-css' );
    }
    Thread Starter harvoolio

    (@harvoolio)

    Essentially all I need to do is write a function to remove
    SC_Class->register_apsc_widget()

    If I comment out the code everything works. I have also tried several combinations including:

    remove_action('wp_enqueue_scripts', 'SC_Class->register_frontend_assets');
    remove_action('wp_enqueue_scripts', 'register_frontend_assets');

    Thanks.

    Plugin Author Access Keys

    (@access-keys)

    Hello there,

    We have released a new version where we have removed the font-awesome dependency from the frontend style and also loaded the font awesome from the CDN.

    We tried several methods to dequeue and remove action that are available in the wordpress codex but unfortunately none of those worked.So we are still find the exact solution of dequeuing and remove the action using some other hooks.

    Thanks.

    Thread Starter harvoolio

    (@harvoolio)

    This matter is still unresolved even though you marked it as resolved. I am forced to go into your plugin and comment out the loading every time you have a revision. The reason why I am opening this up is the problem appears again in your AccessPress Social Share plugin but it is even worse. Not only am I forced to load your front-end, but your front-end is not even complete and not all of my font-awesome icons show.

    I have also emailed support and support has stopped responding.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Option to Dequeue FontAwesome’ is closed to new replies.