• hi my site is already running slow & i am not using gd-star on my home page so i want to deregister it, but confused how to deregister ?

    or i want to load script only when it’s needed, should check the content for the sign of present of the script.

    i used, but failed, still showing script in home page

    <?php wp_deregister_script('gd-star-rating','/wp-content/plugins/gd-star-rating/js/gdsr.js');?>
    <?php wp_deregister_style('gd-star-rating','/wp-content/plugins/gd-star-rating/css/gdsr.css.php');?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • I know this is old, but I had to do this the other day. So if anyone else wants to know how to deregister these on your home page, try the following below:

    add_action( 'wp_print_styles', 'deregister_gdsrstyles', 100 );
    function deregister_gdsrstyles() {
    	if ( is_front_page() ) {
    		wp_deregister_style( 'gdsr_style_main' );
    		wp_deregister_style( 'gdsr_style_xtra' );
    	}
    }
    
    add_action( 'wp_print_scripts', 'deregister_gdsrscript', 100 );
    function deregister_gdsrscript() {
    	if ( is_front_page() ) {
    		wp_deregister_script( 'gdsr_script' );
    	}
    }

    Hey staff, thanks for the code I’m using and is a beauty.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘deregister gd-star rating on home page’ is closed to new replies.