WordPress.org

Ready to get started?Download WordPress

Forums

how to eliminate google-fonts totally (6 posts)

  1. weirdrat
    Member
    Posted 6 months ago #

    hi, can anyone please help a non-scripter like me to get totally rid of google-cloud-fonts in the wordpress-hardcode ? Not only deactivate them - I found several scripts for this - but what do I have to cancel from the wordpress basic code to eliminate any google-connection like if it never had existed .. and other question: are there still enough "normal" self hosted fonts inside ? I saw that even the dashboard now uses this google-crap and want my normal fonts like arial, helvetica, verdana etc back and dont want to leave a trace of this spy-crap google - and please I do not need any advices how useful google fonts are etc - I just want to get rid of them .. thanks a lot in advance .. the rat

  2. Evan Herman
    Member
    Posted 6 months ago #

    Hi Weirdrat,

    You'll need to run through some of your themes .php files and look for any places that there are google link tags pulling in google font files/styles.

    Anything that looks like this:
    <link href='http://fonts.googleapis.com/css?family=Alegreya+Sans' rel='stylesheet' type='text/css'>

    Should be taken out.

    Evan

  3. weirdrat
    Member
    Posted 6 months ago #

    thanks a lot Evan, I already forced my theme author to tell me how to take it out of the theme ..

    the problem is .. since WP 3.8 google- fonts are already in the hardcode of wordpress ... the dashboard runs with google fonts .. I thought to eliminate any chance for google-fonts to enter WP then they automatically will be refused in the themes .. so how can I get that stuff out of the WordPress-Code ??

    thanks in advance
    TR

  4. Sharon Murphy
    Member
    Posted 5 months ago #

    I don't quite have an answer, but here's what my research has turned up:

    This link -- http://codex.wordpress.org/Creating_Admin_Themes -- talks about how to create a theme for your admin (dashboard) side. The basic code for the index.php page for the plugin would be:

    <?php
    /*
    Plugin Name: My Admin Theme
    Plugin URI: http://example.com/my-crazy-admin-theme
    Description: My WordPress Admin Theme - Upload and Activate.
    Author: Ms. WordPress
    Version: 1.0
    Author URI: http://example.com
    */
    function my_admin_theme_style() {
        wp_enqueue_style('my-admin-theme', plugins_url('wp-admin.css', __FILE__));
    }
    add_action('admin_enqueue_scripts', 'my_admin_theme_style');
    add_action('login_enqueue_scripts', 'my_admin_theme_style');
    ?>

    I searched through the list of CSS files used for the admin theme, and here's an abbreviated version of all the tags that include Open Sans (you could create your wp-admin.css file to have these tags changed to another font):

    body, textarea, input, submit { font-family:"Open Sans", sans-serif; }
    .press-this a.wp-switch-editor { font: 13px/19px "Open Sans", sans-serif; }

    (I recommend keeping these two lines separate, since some browsers will not override a 'font:' tag with what is in a 'font-family' tag.)

    Another Option: When creating a child theme and you want to have a file not load, this is the function you add to your theme's function.php page:

    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    
    function my_deregister_styles() {
    	wp_deregister_style( 'wp-pagenavi' );
    }

    (The use of 'wp-pagenavi' is just for an example; inside the pagenavi theme, there is a tag for their stylesheet called 'wp-pagenavi')

    This file -- wp-includes/script-loader.php -- has the following script:
    $open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";

    There must be a way to deregister that script and avoid the use of Open Sans altogether. Anyone have any additional thoughts?

    Hope this helps.

  5. Daniel
    Member
    Posted 3 months ago #

    Hi weirdrat,

    I'm also trying to get rid of Google Fonts entirely from my site. This plugin disables Google Fonts from the WordPress 3.8 backend:

    Disable Google Fonts

    Daniel

  6. Daniel
    Member
    Posted 3 months ago #

    As a general tip to anyone following this thread, and adding to what Evan said above:

    Use a text editor to do a multi-file search for "fonts.googleapis.com" in all your plugin and theme files. This will flag up all the instances where Google Fonts are being called.

    How you stop them being called? That I don't know, unfortunately. But at least with the multi-file search above you can find out if you have them anywhere.

    The only plugin I found on my site that calls Google Fonts was Automattic's Jetpack. I think it's a big mistake to see Automattic doing this and I wish they'd stop. WordPress's values are (or should be) completely irreconcilable with Google's when it comes to privacy and personal data.

Reply

You must log in to post.

About this Topic