0

I am using a Plugin called PixGridder for backend setup, but i dont want the front-end css to apply.. I found that in the plugins functions.php has these lines:

public function front_styles() {
        $theme_style = get_stylesheet_directory().'/gridder.css';
        if (file_exists($theme_style)) {
            wp_enqueue_style( $this->plugin_slug, get_stylesheet_directory_uri().'/gridder.css', array(), $this->version );
        } else {
            wp_enqueue_style( $this->plugin_slug, PIXGRIDDER_URL.'css/front-gridder.css', array(), $this->version );
        }
    }


    add_action( 'wp_enqueue_scripts', array( &$this, 'front_styles' ) );

My question is, how do i unregister this function? or at least prevent the plugin from looking for the front styles though my Theme functions? - and is it even possible to unregister a function through a theme?

Thanks.

1

Same way you would remove it from anywhere else, be it a plugin or theme or whatever.

add_action('plugins_loaded','remove_whatever');
function remove_whatever() {
    if (class_exists('PixGridder')) {
        remove_action( 'wp_enqueue_scripts', array( PixGridder::get_instance(), 'front_styles' ) );
    }
}

Might want to use a better function name than "remove_whatever" though. :)

0

if the plugins_loaded is not working then use init

add_action('init','remove_plugin_style');
function remove_plugin_style() {
    if (class_exists('Gravity_Forms_Live_Validation')) {
        remove_action( 'wp_enqueue_scripts', array( Gravity_Forms_Live_Validation::get_instance(), 'enqueue_styles' ) );
    }
}

its also working fine for me :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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