I am using wp_register_style
and wp_enqueue_style
to add stylesheets to my custom theme. Locally it works as expected, however, on my staging machine instead of adding a link to the CSS file I have specified, it places the CSS directly in my HTML, like:
<style id="titilium-font-css" media="all">
/* CSS styles here */
</style>
Here is how I enqueue my styles:
add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
function register_styles() {
wp_register_style( 'titilium-font', 'http://fonts.googleapis.com/css?family=Titillium+Web:400,600,700' );
wp_enqueue_style( 'titilium-font' );
}
I expect the output to be (and it is locally):
<link rel="stylesheet" id="titilium-font-css" href="http://fonts.googleapis.com/css?family=Titillium+Web%3A400%2C600%2C700&ver=4.0.2" type="text/css" media="all">
Any hints what to look for on the staging machine in order to solve this?
Ok, this behaviour was caused by the mod_pagespeed enabled on the Apache server on the Staging machine. I wish I knew about we having this thing enabled form the start.