I'm not a WordPress developer, I'm trying to help a friend who has a WordPress website. Here is the problem:
In the template, wp_head()
function adds bunch of styles and scripts.
I want to remove some of them in some pages lets say this one:
<link rel='stylesheet' id='yasrcss-css' href='https://www.example.com/wp-content/plugins/yet-another-stars-rating/css/yasr.css' type='text/css' media='all' />
So I searched around and based on what I've been suggested on other questions, I added this lines to functions.php
(inside theme folder):
add_action( 'init', '_remove_style' );
function _remove_style() {
wp_dequeue_style( 'yasrcss-css' );
wp_dequeue_style( 'yasr.css' );
}
It didnt work, also I added this in functions.php
:
wp_deregister_style('yasrcss-css');
This one didn't work either.
Am I missing something, is there anything else I should do ?
BTW, I tried this code:
printf(
'<pre>%s</pre>',
var_export( $GLOBALS['wp_scripts']->registered, TRUE )
);
as suggested here. It didn't have that particular CSS in the output.
yasrcss
, notyasrcss-css
(WordPress adds the-css
suffix for theid
atttribute)