Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

WPML plugin comes with its own CSS file. I want to get rid of all the CSS it contains, so I put everything between /* */. However I'll have to do that again when I'll update the plugin. Is there a way to "unload" a CSS file ?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can use wp_dequeue_style function, with a wp_enqueue_script hook with priority higher than WPML's wp_enqueue_script hook. Put the following code into your functions.php:

function dequeue_wpml_styles(){
    wp_dequeue_style( 'wmpl_style_handle' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_wpml_styles', 20 );

REPLACE 'wmpl_style_handle' with the handle WPML registers/enqueues the style.

UPDATE: I have just had a look into WPML and it looks that it doesn't use wp_enqueue_script to include language-selector.css, But the good news is that there is a constant which you can set to prevent loading of the language selector styles. Just add the line below to your functions.php:

define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
share|improve this answer
    
Thanks, but I got this message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'mysite.com/.../plugins/sitepress-multilingual-cms/res/css/…; not found or invalid function name in /home/blabla/public_html/mysite.com/wp-includes/plugin.php on line 403 –  drake035 Oct 24 '12 at 15:00
    
Please make sure the call back name you register with add_action matches your function name. In the sample above, it's 'dequeue_wpml_styles'. And where did you exactly put the code? –  Parham Oct 24 '12 at 15:11
    
I added it at the end of functions.php. Here's the exact line of code I put: add_action( 'wp_enqueue_scripts', plugins_url('/sitepress-multilingual-cms/res/css/language-selector.css', FILE), 20 ); –  drake035 Oct 24 '12 at 16:28
    
@drake035 See my updated answer above. –  Parham Oct 24 '12 at 17:07
    
thanks a lot, works perfectly! One more thing: how did you find so quickly that WPML provides a constant for this? –  drake035 Oct 24 '12 at 18:32
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.