[Resolved] Bad Request 400 to Google Apis

Home Forums Support [Resolved] Bad Request 400 to Google Apis

Home Forums Support Bad Request 400 to Google Apis

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #577250

    I’m trying to do a little test of two hosts and somehow on one host I get a bad 400 request for css rather than a 200.

    <link rel=”stylesheet” id=”generate-fonts-css” href=”//fonts.googleapis.com/css” type=”text/css” media=”all”>

    on the other one I get this which works.
    <link rel=”stylesheet” id=”generate-fonts-css” href=”//fonts.googleapis.com/css?family=Lato:300,regular” type=”text/css” media=”all”>

    I checked the settings under fonts and they are the same. I’m really scratching my head. I cloned the site over so it should be 99.9% the same. Is there anything you can think of to check? I’m sure this will be a learning lesson. Thanks!

    GP Premium 1.6.2
    Lead Developer
    Lead Developer

    Hi there,

    That’s strange – it’s like the value of your Google Font setting isn’t coming through. Perhaps it was lost when you cloned the site.

    Can you try re-setting it in the Customizer and then save the options?


    I have. I tried setting it to inherit and then back to Lato. =\ I tried turning off caching as well. Do you want an admin login?


    I figured it out. I guess I forgot I had activated a snippet to remove query string from static resources. I suppose that breaks the googleapi call? I’ll have to double check the forum.

    function _remove_script_version( $src ){ 
    $parts = explode( '?', $src ); 	
    return $parts[0]; 
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); 
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    Lead Developer
    Lead Developer

    Ah yes, that’ll do it.

    Removing query strings will give you better scores with page speed tools, but that’s it. Doing it will cause a lot of issues, and it won’t make your site faster.

    Basically that code removes everything after the ? character in a resources, which includes the names of the Google fonts.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.