Stylesheet from wp_enqueue_style is overwritten by plugin

Just use wp_register_style() and wp_enqueue_style() correctly. Register your stylesheet on wp_loaded, enqueue it on wp_enqueue_scripts. add_action( ‘wp_loaded’, function() { wp_register_style( ‘fontawesome’, ‘//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css’ ); }); add_action( ‘wp_enqueue_scripts’, function() { wp_enqueue_style( ‘fontawesome’ ); }); When someone tries to call wp_enqueue_style() with an URL, WordPress will try to register it automatically, doing the work of wp_register_style() behind the … Read more

Remove inline css added by wp_add_inline_css

If wp_add_inline_css is fired within an action you can use remove_action with the same parameters. You also might use wp_enqueue_scripts action to dequeue any scripts or styles in a proper way. But, inline style are not included in the $wp_styles global, you can unset them with the action print_styles_array, you need to know the handle … Read more

Duplicated CSS files using wp_enqueue_style()

Naming conventions for scripts and styles have always been a difficult issue in WordPress plugins, with many different conventions used and often causing conflicts. I’ll try to give my view on this matter, and elaborate where necessary. Let me start off by stating my opinion on the example in your question: in my opinion, only … Read more

Enqueue a css using negative conditional tags

The bug’s only 4 years old so you wouldn’t want to rush them would you?! A workaround is to leave out the wp_style_add_data() and use the ‘style_loader_tag’ filter: add_filter( ‘style_loader_tag’, function ( $tag, $handle ) { if ( $handle == ‘purecss-all-not-ie’ ) { $tag = “<!–[if gt IE 8]><!–>\n” . $tag . “<!–<![endif]–>\n”; } return … Read more

How Would You Enqueue A Google Web Font?

You should be able to just use http://fonts.googleapis.com/css?family=Rosario:400,700,400italic which is the “combined” URL given by Google when selecting multiple weights/styles of a font. You can then just register the font once. You don’t need to over-complicate the $handle either, something like google-fonts-rosario should do just fine as long as it is unique as mentioned in … Read more

How to add extra attribute to stylesheet link?

We can use style_loader_tag filter to filter the link that is being output. Here is the filter: $tag = apply_filters( ‘style_loader_tag’, “<link rel=”$rel” id=’$handle-css’ $title href=”https://wordpress.stackexchange.com/questions/231597/$href” type=”text/css” media=”$media” />\n”, $handle, $href, $media); Here the link $handle for which you want to add attribute is font-awesome so if the handle, so you can replace font-awesome-css with … Read more