Viewing 8 replies - 1 through 8 (of 8 total)
  • @remarketingo You can disable fontawesome by adding this to your functions.php file:

    
    function remove_genesis_blocks_fontawesome() {
    	wp_dequeue_style( 'genesis-blocks-fontawesome' );
    }
    add_action( 'init', 'remove_genesis_blocks_fontawesome', 20 );
    add_action( 'enqueue_block_editor_assets', 'remove_genesis_blocks_fontawesome', 20 );
    
    

    HI Luke – thanks for helping with this issue. I tried adding this to functions. That helped with speed testing, however a new issue was found by Google. It appears to be calling a file from root. Any thoughts on what that might be?
    Thank you

    Hi @sanostec –?I’m not sure what “calling a file from root” means, or why it’s a problem. Could you post more information?

    Hi Luke – thanks for getting back to me. Sorry to have used the wrong language. Once the code was added to remove the font awesome, Google insights says Remove Unused CSS. Now that font awesome is no longer loaded, instead it looks like all of the unused css for the site is loaded instead. Its a big file.

    It begins with
    :root{–wp-admin-theme-color:#007cba;–wp-admin-theme-color-darker-10:#006ba1;–wp-admin-theme-color-darker-20:#005a87}#start-resizable-editor-section{display:none}.wp-block-audio figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-audio audio{width:100%;min-width:300px}.wp-block-button__link{color:#fff;background-color:#32373c;border:none; ETC…

    I’m trying to figure out why this css doesn’t show until we remove font awesome.

    Thanks for your help.

    I’m not a developer, but maybe the ‘enqueue_block_editor_assets’ before the ‘remove_genesis_blocks_fontawesome’, 20 in your code above is causing this?

    I tried removing that second line in your code and it didn’t make any difference to page speed insights. Site is still functioning but all that css is still loading and causing render blocking and unused css messages.

    Appreciate your thoughts. I put your remove snippet at the end of the functions.php file. Should it be placed somewhere else in the file?

    one last thought, I located this removal code as well.

    if ( wp_style_is( ‘genesis-blocks-fontawesome’ ) ) {
    wp_dequeue_style( ‘genesis-blocks-fontawesome’ );
    wp_deregister_style( ‘genesis-blocks-fontawesome’ );
    }

    Thank you

    Hi,
    Thanks for the code. I tried it and it works, but there are some PHP warnings that this will throw an Error in a future version of PHP.

    Warning: Use of undefined constant ‘genesis – assumed ”genesis’
    Warning: Use of undefined constant blocks – assumed ‘blocks’
    Warning: A non-numeric value encountered
    Warning: A non-numeric value encountered
    Warning: Use of undefined constant fontawesome’ – assumed ‘fontawesome”
    Warning: A non-numeric value encountered in
    Warning: call_user_func_array() expects parameter 1 to be a valid callback

    This is the code I used:

    
    function remove_genesis_blocks_fontawesome() {
    	wp_dequeue_style( 'genesis-blocks-fontawesome' );
    }
    add_action( 'init', 'remove_genesis_blocks_fontawesome', 20 );
    add_action( 'enqueue_block_editor_assets', 'remove_genesis_blocks_fontawesome', 20 );
    
    if ( wp_style_is( ‘genesis-blocks-fontawesome’ ) ) {
    wp_dequeue_style( ‘genesis-blocks-fontawesome’ );
    wp_deregister_style( ‘genesis-blocks-fontawesome’ );
    }

    The warnings are referring to this line:

    
    if ( wp_style_is( ‘genesis-blocks-fontawesome’ ) ) {
    
    
    • This reply was modified 3 years, 8 months ago by handig.
    • This reply was modified 3 years, 8 months ago by handig.
    • This reply was modified 3 years, 8 months ago by handig.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disable Font Awesome’ is closed to new replies.