• Hi,

    I want to remove OceanWP buddypress.min.css and I’m having issues with wp_dequeue_style. I’m trying the below code and it still doesn’t remove the buddypress css file loaded by oceanwp

    function oceanwp_child_enqueue_parent_style() {
    
       $theme   = wp_get_theme( 'OceanWP' );
       $version = $theme->get( 'Version' );
    
       // Load the stylesheet
       wp_enqueue_style( 'ialstyle', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );
    
       // remove oceanwp buddypress style
       wp_dequeue_style( 'oceanwp-buddypress' );
       wp_deregister_style( 'oceanwp-buddypress' );
    
    }
    
    add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style', 999999 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @shubh14,

    Instead of the above code, please use the following hook:

    function myFunctionToRemove(){
       wp_dequeue_style( 'oceanwp-buddypress' );
       wp_deregister_style( 'oceanwp-buddypress' );
    }
    add_action( 'wp_enqueue_scripts','myFunctionToRemove', 11 );

    Note: if you have any cache plugin or server cache(CDN / Browser Cache and Cookies and …), you need to clear its cache contents or disable them to see your changes. Also, remember to click on the regenerate all assets file and data in Elementor > Tools(if you have Elementor).

    I hope that helps.
    Please recheck your issue and keep us posted.

    Best Regards

    Thread Starter shubh14

    (@shubh14)

    Thank you for replying.

    I used the code mentioned by you, but it still didn’t remove the oceanwp buddypress css file. I don’t have a cache plugin or elementor. I cleared the browser cache as well.

    The only way I can remove the file is if I edit the parent theme class-buddypress.php file, which I don’t want to do because then I’ll have to edit the file after every theme update.

    Thank you for your help.

    Hello @shubh14,

    Thank you for reaching out to us,
    Although the previous hook works on my test site, you can try this one too:

    // remove oceanwp buddypress style
    function oceanwp_bp_removestyle() {
        if ( class_exists( 'BuddyPress' ) ) {
            wp_dequeue_style( 'oceanwp-buddypress' );
        }
    }
    add_action( 'wp_print_styles', 'oceanwp_bp_removestyle', 100 );

    Note: remember clear all level cache and cookies on wordpress, browser, and host or CDN.
    Screenshots: https://postimg.cc/gallery/nCB9MCs.
    I hope that helps.
    Best Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Issues with Buddypress wp_dequeue_style’ is closed to new replies.